Compare commits

...

62 commits

Author SHA1 Message Date
micmac1
e2f3704624
Merge pull request #787 from micmac1/gsm-no-nls-21.02
[21.02] gsmlib: disable NLS
2022-10-31 07:37:14 +01:00
Sebastian Kemper
728b42e3a3 gsmlib: disable NLS
It's not wanted, so add "--disable-nls" to override user selecting
CONFIG_BUILD_NLS.

This also updates 01-update-autotools.patch to make these disappear:

ERROR: Use of AM_GNU_GETTEXT without [external] argument is no longer supported.

Makefile.am:21: warning: 'intl' should not be in SUBDIRS when AM_GNU_GETTEXT([external]) is used

Signed-off-by: Sebastian Kemper <sebastian_ml@gmx.net>
(cherry picked from commit b86cf0cdc6)
2022-10-30 09:27:07 +01:00
micmac1
89cc8fccf7
Merge pull request #770 from micmac1/21.02-sof-1.13.8
[openwrt-21.02] sofia-sip: bump to 1.13.8
2022-05-31 21:21:09 +02:00
Sebastian Kemper
3e2e3a19b3 sofia-sip: bump to 1.13.8
Some security issues were fixed. Upstream labelled them as follows:

GHSA-79jq-hh82-cv9g: Fix Out-of-bound read in sip_method_d
GHSA-g3x6-p824-x6hm: Fix Out-of-bound read in url_canonize2 and
                     url_canonize3
GHSA-8w5j-6g2j-pxcp: Fix Heap-buffer-overflow in parse_descs and
                     parse_message

Signed-off-by: Sebastian Kemper <sebastian_ml@gmx.net>
(cherry picked from commit 1efc4f3f98)
2022-05-31 21:11:26 +02:00
Jiri Slachta
818a3776c7
Merge pull request #761 from micmac1/21.02-AST-2022-01-02-03
[21.02] bump asterisk to 18.11.2
2022-04-19 12:29:43 +02:00
Sebastian Kemper
3181481463 asterisk: bump to version 18.11.2
asterisk: update AST_EXT_TOOL_CHECK for OpenWrt

Issue #672 shows that the current macro has some pitfalls, at least when
running within OpenWrt's buildroot.

The macro is used to detect these tools:

  1. xml2-config
  2. mysql_config
  3. neon-config
  4. net-snmp-config
  5. sdl-config (we're not using SDL)

The macro also adds configure arguments that allow to specify a path
like so:

  --with-mysqlclient=PATH

Macro problems:

  1. If no PATH is specified, it adds "/bin" to the search path.
     Obviously this is a bad thing when cross-compiling.
  2. If a PATH is specified, it adds it to the start of every include
     and library path it encounters. These paths are then broken.

This commit makes problem 1 go away by making the addition of
"${$1_DIR}/bin" to the PATH dependent on there being a PATH handed to
the macro. An alternative would be to remove the PATH addition
altogether, but then the macro wouldn't behave as expected.

It also removes the path filtering of the include and lib dirs to
address problem 2.

Closes #672

Signed-off-by: Sebastian Kemper <sebastian_ml@gmx.net>
(cherry picked from commit 79a0acfe56)

asterisk: bump to 18.7.1

The removed patch has been applied upstream and is part of this release.

Signed-off-by: Andre Heider <a.heider@gmail.com>
(cherry picked from commit 0399a3dc73)

asterisk: add missing modules + dependency

Signed-off-by: Sebastian Kemper <sebastian_ml@gmx.net>
(cherry picked from commit 04b6b267f1)

asterisk: fix build on macos

This commit adds a patch to fix /sbin/launchd detection on macos

Signed-off-by: Sergey V. Lobanov <sergey@lobanov.in>
(cherry picked from commit 4209a36afe)

asterisk: bump to version 18.11.2

- add two new modules (app_sf and func_json)
- update 100-build-reproducibly.patch as upstream refactored some of the
  code
- refresh patches

This bump includes fixes for the following security issues:

https://downloads.asterisk.org/pub/security/AST-2022-001.html
https://downloads.asterisk.org/pub/security/AST-2022-002.html
https://downloads.asterisk.org/pub/security/AST-2022-003.html

Signed-off-by: Sebastian Kemper <sebastian_ml@gmx.net>
(cherry picked from commit 958401fa8f)

asterisk: add --without-libxslt to configure

Since upstream commit b40c4d59b1dd803cad79060fb5b5a48d249ba578
"--disable-xmldoc" does no longer prevent the linking to libxslt, if
available. If that's the case one is greeted with the following error:

Package asterisk is missing dependencies for the following libraries:
libxslt.so.1

This commit explicitly disables the use of libxslt, to avoid the
dependency.

Signed-off-by: Sebastian Kemper <sebastian_ml@gmx.net>
(cherry picked from commit 64a1d2faef)
2022-04-18 17:56:18 +02:00
Andre Heider
ccc57cff3c pjproject: sync patches with asterisk 18.11.2
pjproject: sync patches with asterisk 18.7.1

Signed-off-by: Andre Heider <a.heider@gmail.com>
(cherry picked from commit 376473b38c)

pjproject: sync patches with asterisk 18.11.2

Signed-off-by: Sebastian Kemper <sebastian_ml@gmx.net>
(cherry picked from commit 0c67ab5831)
2022-04-18 17:55:41 +02:00
micmac1
0183c1adda
Merge pull request #753 from micmac1/openwrt-21.02-AST
[21.02] pjproject: add upstream security fixes
2022-03-06 12:31:34 +01:00
Sebastian Kemper
ab9fc722ae pjproject: add upstream security fixes
Details:

https://downloads.asterisk.org/pub/security/AST-2022-004.html
https://downloads.asterisk.org/pub/security/AST-2022-005.html
https://downloads.asterisk.org/pub/security/AST-2022-006.html

Signed-off-by: Sebastian Kemper <sebastian_ml@gmx.net>
(cherry picked from commit 623e5288f1)
2022-03-06 12:18:39 +01:00
micmac1
4bff07ae2e
Merge pull request #746 from micmac1/pj-AST-2021-009-2-21.02
[21.02] pjproject: add missing patch for AST-2021-009
2022-02-20 23:38:22 +01:00
Sebastian Kemper
4bea715a41 pjproject: add missing patch for AST-2021-009
AST-2021-009 has two patches, the second of which was missed.

Signed-off-by: Sebastian Kemper <sebastian_ml@gmx.net>
(cherry picked from commit 1ac119d6c8)
2022-02-20 23:35:04 +01:00
micmac1
001ae7137c
Merge pull request #733 from micmac1/sof-1137-21
[21.02] sofia-sip: update to 1.13.7
2022-01-31 19:55:35 +01:00
Sebastian Kemper
e07c757266 sofia-sip: update to 1.13.7
Contains DOS fix, see [1].

Converted to AUTORELEASE.

[1] https://github.com/signalwire/freeswitch/issues/1518

Signed-off-by: Sebastian Kemper <sebastian_ml@gmx.net>
(cherry picked from commit f04a5a2383)
2022-01-31 19:36:47 +01:00
micmac1
ec88aa7ab0
Merge pull request #727 from micmac1/dong-head-21
[21.02] asterisk-chan-dongle: update to the latest git HEAD
2022-01-04 14:28:08 +01:00
Shaleen Jain
033dfdcd14 asterisk-chan-dongle: update to the latest git HEAD
The upstream commit 6073c91fcf0a46a1525d500c274fa5ab96af7dda broke
non-quectel devices due to the channel driver unable to complete
initialization.

This is fixed in the latest upstream commit.

Signed-off-by: Shaleen Jain <shaleen@jain.sh>
(cherry picked from commit 409e797785)
2022-01-04 14:21:08 +01:00
Jiri Slachta
922009f1b2
Merge pull request #716 from micmac1/restund-cve-21.02
[21.02] restund: fix CVE-2021-21382
2021-12-08 06:58:06 +01:00
Sebastian Kemper
dec6316f2f restund: fix CVE-2021-21382
Patches taken from [1].

[1] https://github.com/wireapp/restund/pull/7

Signed-off-by: Sebastian Kemper <sebastian_ml@gmx.net>
2021-12-07 00:03:02 +01:00
micmac1
be93cb755c
Merge pull request #711 from micmac1/2102-dongle-fixes
[21.02] asterisk + asterisk-chan-dongle fixes
2021-11-09 19:26:19 +01:00
Sebastian Kemper
466cd85111 asterisk-chan-dongle: add postinst note
Provide quick hint to users to sort out possible/likely permission
issue.

Also refreshes some patches.

Signed-off-by: Sebastian Kemper <sebastian_ml@gmx.net>
(cherry picked from commit 829c1cf031)
2021-11-09 19:14:21 +01:00
Sebastian Kemper
e6cf1a7b63 asterisk: don't start with explicit group
Currently the asterisk init script starts the service with the group
"asterisk". Like this, even if the asterisk user is part of other groups,
asterisk will not be able to make use of them. So for instance if you add the
user to the group "dialout", asterisk will run under group "asterisk", instead
of "asterisk" _and_ "dialout".

Not specifying the group gets rid of this limitation.

Signed-off-by: Sebastian Kemper <sebastian_ml@gmx.net>
(cherry picked from commit 9017e04b87)
2021-11-09 19:12:52 +01:00
Deomid "rojer" Ryabkov
b688d953ac asterisk-chan-dongle: bump for upstream fixes
To pull in fixes, specifically 3d2a97f26b which fixes decoding of SMS messages.

Also fixes https://github.com/openwrt/telephony/issues/686
and pulls in Quectel support (alternative to https://github.com/openwrt/telephony/pull/682).

Signed-off-by: Deomid "rojer" Ryabkov <rojer@rojer.me>
(cherry picked from commit 02d5dc545e)
2021-11-09 19:10:43 +01:00
micmac1
5c49ca9289
Merge pull request #707 from micmac1/2102-fs1107
[21.02] freeswitch: security update to 1.10.7
2021-11-08 00:21:56 +01:00
Sebastian Kemper
ee12e24d26 freetdm: add package
It was moved from the freeswitch source tree into its own package.

Signed-off-by: Sebastian Kemper <sebastian_ml@gmx.net>
(cherry picked from commit fd0c65d379)

freetdm: fix PKG_CONFIG_DEPENDS

One is missing and one is misspelled.

Signed-off-by: Sebastian Kemper <sebastian_ml@gmx.net>
(cherry picked from commit 4c24ad93d3)

freetdm: remove wrong InstallDev defines

They currently don't work, but we don't need them anyway. This removes
them.

Signed-off-by: Sebastian Kemper <sebastian_ml@gmx.net>
(cherry picked from commit 70fa153500)
2021-11-07 23:57:10 +01:00
Sebastian Kemper
7414fc91b5 sofia-sip: bump to 1.13.6
Required for freeswitch 1.10.7.

Signed-off-by: Sebastian Kemper <sebastian_ml@gmx.net>
(cherry picked from commit 940613cd7b)
2021-11-07 23:33:50 +01:00
Sebastian Kemper
0ca47d2ef1 freeswitch: bump to 1.10.7
- freetdm is now external
- added the freeswitch library to InstallDev in preparation for freetdm
  package
- various fixes related to general build
- patches refreshed

Signed-off-by: Sebastian Kemper <sebastian_ml@gmx.net>
(cherry picked from commit 4ab96a1879)

freeswitch: add python3 support

Signed-off-by: Sebastian Kemper <sebastian_ml@gmx.net>
(cherry picked from commit 652d110b2f)

freeswitch: fix 230-mod_radius_cdr.patch

This is a patch in a patch. It may happen that the patch was already
applied previously, so this amends the patch line to continue if the
patch doesn't apply. It also sets the direction to forward-only.

Also removes two trailing whitespace warnings.

Signed-off-by: Sebastian Kemper <sebastian_ml@gmx.net>
(cherry picked from commit 3fafe1afac)

freeswitch: only include python3-version.mk

We're just interested in the version, no need to include more than that.

Signed-off-by: Sebastian Kemper <sebastian_ml@gmx.net>
(cherry picked from commit 42574d54d4)

freeswitch: don't check for distutils

We're not using distutils, so don't check for it. This fixes #704.

Signed-off-by: Sebastian Kemper <sebastian_ml@gmx.net>
(cherry picked from commit eb145cd014)

freeswitch: update 480-fix-libyuv-dependency.patch

Update the patch with the version that actually was applied upstream. No
functional change.

Signed-off-by: Sebastian Kemper <sebastian_ml@gmx.net>
(cherry picked from commit 6004044dc0)

freeswitch: add missing item to PKG_CONFIG_DEPENDS

Signed-off-by: Sebastian Kemper <sebastian_ml@gmx.net>
(cherry picked from commit ebcdcb3547)
2021-11-07 23:21:46 +01:00
micmac1
ed27198671
Merge pull request #696 from micmac1/lan-up-21.02
[21.02] asterisk-chan-lantiq: update for DTMF fix
2021-10-22 17:37:35 +02:00
Sebastian Kemper
dced965517 asterisk-chan-lantiq: update for DTMF fix
Bump to last commit. Includes fix for DTMF causing call release when
using Asterisk 18 (see [1]).

[1] https://github.com/openwrt/telephony/issues/631

Signed-off-by: Sebastian Kemper <sebastian_ml@gmx.net>
(cherry picked from commit ec6ba744b0)
2021-10-22 17:33:51 +02:00
micmac1
7f73a9ad19
Merge pull request #680 from micmac1/rtpe-up2
[21.02] rtpengine: bump to version 8.5.5.1
2021-08-30 10:41:46 +02:00
Sebastian Kemper
da026a44f4 rtpengine: bump to version 8.5.5.1
This also:

 - fixes /etc/modules.d/ipt-rtpengine (needs user and group ids instead
   of names)
 - adds user as well when kmod is installed so that abovementioned user
   and group ids are available
 - adds /etc/modules.d/ipt-rtpengine to conffiles

Signed-off-by: Sebastian Kemper <sebastian_ml@gmx.net>
2021-08-29 23:00:33 +02:00
Jiri Slachta
df7208f616
Merge pull request #667 from robho/yate_6.4.0_for_21.02
[21.02] yate: bump to 6.4.0
2021-08-16 21:06:51 +02:00
Jiri Slachta
4dc042961f
Merge pull request #668 from micmac1/21ast1851
[21.02] Backport Asterisk 18.5.1 bump
2021-08-16 21:06:07 +02:00
micmac1
c1391b570e
Merge pull request #670 from micmac1/21sof14
[21.02] sofia-sip: bump to 1.13.4
2021-08-11 23:01:16 +02:00
Sebastian Kemper
caea1c41df asterisk: bump to 18.5.1
Update deps of asterisk-res-pjproject. It depends on res_sorcery_config,
which is part of asterisk-res-sorcery.

Signed-off-by: Sebastian Kemper <sebastian_ml@gmx.net>
2021-08-06 20:43:57 +02:00
Sebastian Kemper
54ad579b30 pjproject: sync patches with asterisk 18.5.1
Signed-off-by: Sebastian Kemper <sebastian_ml@gmx.net>
2021-08-06 20:43:25 +02:00
Sebastian Kemper
b3f4993851 sofia-sip: bump to 1.13.4
Fixes some issues, for instance a segfault during shutdown when
sofia-sip wasn't fully loaded, see [1]. The segfault was reproducible
by simply calling "freeswitch -help".

The added patch is to address a library versioning regression, patch is
from upstream.

[1] https://github.com/freeswitch/sofia-sip/issues/58

Signed-off-by: Sebastian Kemper <sebastian_ml@gmx.net>
2021-08-06 20:27:46 +02:00
Robert Högberg
3bc13cba19 yate: bump to 6.4.0
Signed-off-by: Robert Högberg <robert.hogberg@gmail.com>
2021-08-04 23:28:45 +02:00
Jiri Slachta
aa19540243
Merge pull request #660 from dangowrt/asterisk-18.5.0-for-21.02
asterisk: update to version 18.5.0 and backport patch
2021-07-22 14:39:16 +02:00
Daniel Golle
a58d120e0e asterisk: update to version 18.5.0 and backport patch
Update to upstream version 18.5.0 and backport commit[1] completing the
announcements in Dial command to behave like it is stated in the
documenation[2].

[1]: 1e5a2cfe30
[2]: https://wiki.asterisk.org/wiki/display/AST/Asterisk+18+Application_Dial

Signed-off-by: Daniel Golle <daniel@makrotopia.org>
(cherry picked from commit 20e8c3b2d9)
2021-07-22 13:30:03 +01:00
Jiri Slachta
ee64ec42e9
Merge pull request #647 from robho/yate-6.3.0_21.02
[21.02] yate: bump to 6.3.0 and enable speex codec
2021-06-08 08:28:11 +02:00
Robert Högberg
87fd562617 yate: bump to 6.3.0 and enable speex codec
New yate modules in this release:
yate-mod-ilbcwebrtc
yate-mod-speexcodec
yate-mod-wiresniff

Some patches were removed:
110-no-libnsl.patch - not needed
120-create-thread-key-on-access.patch - not needed
150-video-codecs-mapping.patch - already applied upstream

Some additional changes:
* An upstream fix (r6470) is cherry-picked to avoid crashing when YATE
  receives an invalid SIP message.

* Build directory changed to include package version.

* Set PKG_BUILD_PARALLEL to allow parallelized build of yate.

* Speed up build if yate-mod-ilbccodec or yate-mod-sqlitedb is
  disabled (disable ilbc and sqlite in configure step).

* Removing umbrella package yate-collection-basic. It isn't built and
  hasn't been built for years and I think the modules it wants to
  install are a bit strange and probably not useful to most
  users. From the name yate-collection-basic I would expect to get
  some basic functionality, but why would I then need
  yate-mod-dumbchan, yate-mod-rmanager and yate-mod-tonegen? What is
  the use case? I think it's better that users themselves install the
  packages needed for their use case, especially in OpenWrt where
  flash space usually is limited and you don't want to install more
  packages than what you really need.

Signed-off-by: Robert Högberg <robert.hogberg@gmail.com>
2021-06-07 12:48:38 +02:00
micmac1
04e1378baf
Merge pull request #645 from micmac1/fs1106-nua-mem-leak-21.02
[21.02] sofia-sip: add upstream fix for memory leak
2021-05-27 22:03:16 +02:00
Sebastian Kemper
45f39f1d45 sofia-sip: add upstream fix for memory leak
Upstream provided a patch for a memory leak in Sofia SIP (see [1] for
more information).

[1] https://github.com/signalwire/freeswitch/issues/1174

Signed-off-by: Sebastian Kemper <sebastian_ml@gmx.net>
2021-05-27 20:20:54 +02:00
Jiri Slachta
90a8f084cf asterisk: update to 18.4.0
Patches updated/refreshed:

100-build-reproducibly.patch
130-eventfd.patch
140-use-default-lua.patch

Signed-off-by: Jiri Slachta <jiri@slachta.eu>
2021-05-12 21:30:11 +02:00
micmac1
1788229571
Merge pull request #638 from micmac1/rtpe-8533-21.02
rtpengine: bump to 8.5.3.3
2021-04-18 12:14:05 +02:00
Sebastian Kemper
3ead65a298 rtpengine: fix Module.symvers handling
This sets PKG_EXTMOD_SUBDIRS so kernel.mk can find the rtpengine
Module.symvers file.

Also, this puts KERNEL_MAKE_FLAGS into the make flags used to compile
the kernel module. This way Module.symvers files of other modules are
made available, plus there is no need anymore to specify ARCH and
CROSS_COMPILE, as KERNEL_MAKE_FLAGS already takes care of that.

While updating make flags this also adds PKG_JOBS for completeness'
sake.

Signed-off-by: Sebastian Kemper <sebastian_ml@gmx.net>
2021-04-18 12:10:58 +02:00
Sebastian Kemper
ec7ac00999 rtpengine: build in BUILD_DIR
rtpengine is not primarily about kernel modules. It's an application
(which also offers a kernel module). So build it in BUILD_DIR instead of
KERNEL_BUILD_DIR.

Signed-off-by: Sebastian Kemper <sebastian_ml@gmx.net>
2021-04-18 12:09:45 +02:00
Sebastian Kemper
c72f51bac2 rtpengine: bump to 8.5.3.3
Contains upstream fix for G.729 recording with bcg729.

Signed-off-by: Sebastian Kemper <sebastian_ml@gmx.net>
2021-04-18 12:01:08 +02:00
micmac1
2d24c9eb2a
Merge pull request #635 from micmac1/fs-modmake-patch-21.02
[21.02] freeswitch: fix 003-modmake-fix.patch
2021-04-08 22:02:15 +02:00
Sebastian Kemper
a0a097f604 freeswitch: fix 003-modmake-fix.patch
Somehow this white space change slipped in unintentionally.

Signed-off-by: Sebastian Kemper <sebastian_ml@gmx.net>
2021-04-07 20:54:05 +02:00
micmac1
79fafd3726
Merge pull request #632 from micmac1/fs-1106-21.02
[21.02] update freeswitch to 1.10.6
2021-04-04 10:47:41 +02:00
Sebastian Kemper
1cb886e052 freeswitch: rework init & hotplug
This adds a term_timeout uci option which can be used to change the
default timeout that procd uses while waiting for freeswitch to exit
once the TERM signal is sent. freeswitch may take a bit longer to exit,
so adding this option is likely appreciated. By default procd's default
is used, though.

Logging is updated in init script and hotplug script. The used facility
is changed from user to daemon, for instance.

An issue was fixed in the parsing of the ntpq output. In case a positive
offset was printed the parsing failed. Apparently ntpq is now adding a
'+', so this is now accounted for.

Signed-off-by: Sebastian Kemper <sebastian_ml@gmx.net>
2021-04-03 09:14:05 +02:00
Sebastian Kemper
e21e40486d freeswitch: update to 1.10.6
- patches which are now upstream were removed
- some patches were refreshed
- 003-modmake-fix.patch was amended a bit because of upstream commit
  91f12b5 (it changed tests/unit/Makefile.am so that it doesn't
  redefine AM_CFLAGS and AM_CPPFLAGS, which results in duplicated flags)

Signed-off-by: Sebastian Kemper <sebastian_ml@gmx.net>
2021-04-03 09:07:29 +02:00
Jiri Slachta
bdaf85981b
Merge pull request #628 from micmac1/21.02-ast-backports
[21.02] asterisk backports
2021-03-25 12:35:51 +01:00
micmac1
3179b75fa2
Merge pull request #627 from micmac1/21.02-seb-backports
[21.02] freeswitch/sngrep backports
2021-03-21 19:55:31 +01:00
Sebastian Kemper
fad04b6d2e asterisk: update to 18.2.2
Updated 140-use-default-lua.patch.

Patches refreshed:
  001-disable-semaphores-on-uclibc-otherwise-allow.patch
  002-configure-fix-detection-of-re-entrant-resolver-funct.patch
  100-build-reproducibly.patch
  130-eventfd.patch

Signed-off-by: Sebastian Kemper <sebastian_ml@gmx.net>
2021-03-20 09:33:41 +01:00
Sebastian Kemper
9452a933ad pjproject: sync patches with asterisk 18.2.2
Signed-off-by: Sebastian Kemper <sebastian_ml@gmx.net>
2021-03-19 18:13:31 +01:00
Sebastian Kemper
4786b9aa7d pjproject: drop autoreconf, run make dep
Neither configure.ac nor configure.in exists, so autoreconf is a no-op.
This commit drops it.

Also, run "make dep" as advertised by the README and the configure
script.

Signed-off-by: Sebastian Kemper <sebastian_ml@gmx.net>
2021-03-19 18:13:21 +01:00
Sebastian Kemper
0189f67bd2 pjproject: add patch for AST-2021-005
https://downloads.asterisk.org/pub/security/AST-2021-005.html
https://issues.asterisk.org/jira/browse/ASTERISK-29196

Signed-off-by: Sebastian Kemper <sebastian_ml@gmx.net>
2021-03-19 18:13:02 +01:00
Sebastian Kemper
b69c7eedd7 sngrep: bump to 1.4.8
Signed-off-by: Sebastian Kemper <sebastian_ml@gmx.net>
2021-03-19 18:05:16 +01:00
Sebastian Kemper
73bae4f168 spandsp3: bump to 2020-10-19
Signed-off-by: Sebastian Kemper <sebastian_ml@gmx.net>
2021-03-19 18:05:06 +01:00
Sebastian Kemper
702ee9a3df sofia-sip: bump to 1.13.3
Upstream now provides a release tarball. Use that instead of a git
checkout.

Signed-off-by: Sebastian Kemper <sebastian_ml@gmx.net>
2021-03-19 18:04:43 +01:00
Sebastian Kemper
2755c30ff1 libks: bump to 1.7.0
Drops 05-openssl-deprecated.patch as included upstream.

Signed-off-by: Sebastian Kemper <sebastian_ml@gmx.net>
2021-03-19 18:04:20 +01:00
73 changed files with 3344 additions and 579 deletions

12
libs/freetdm/Config.in Normal file
View file

@ -0,0 +1,12 @@
menu "Configuration"
depends on PACKAGE_freetdm
config FREETDM_WITH_DEBUG
bool "Compile with debug information"
default n
help
Enable extra debug codepaths, like asserts and extra output. If you
want to get meaningful backtraces see
https://wiki.openwrt.org/doc/devel/debugging for starting points.
endmenu

155
libs/freetdm/Makefile Normal file
View file

@ -0,0 +1,155 @@
#
# Copyright (C) 2021 Sebastian Kemper <sebastian_ml@gmx.net>
#
# This is free software, licensed under the GNU General Public License v2.
# See /LICENSE for more information.
#
include $(TOPDIR)/rules.mk
PKG_NAME:=freetdm
PKG_RELEASE:=1
PKG_MAINTAINER:=Sebastian Kemper <sebastian_ml@gmx.net>
PKG_SOURCE_PROTO:=git
PKG_SOURCE_URL:=https://github.com/freeswitch/freetdm.git
PKG_SOURCE_DATE:=2021-08-30
PKG_SOURCE_VERSION:=8918ee1c3637cad0f9d41a402d26d3aa076fc202
PKG_MIRROR_HASH:=c910ff0fb62c8a174f6e0bbd749783da1ecd71634d4dcde48b118909f4981943
PKG_FIXUP:=autoreconf
PKG_BUILD_PARALLEL:=1
PKG_INSTALL:=1
PKG_LICENSE:= \
BSD-2-Clause \
BSD-3-Clause \
BSD-4-Clause \
GPL-2.0+ \
MIT/X11 (BSD like) \
MPL-1.1
PKG_LICENSE_FILES:=LICENSE
PKG_BUILD_DEPENDS:=freeswitch
FS_EXAMPLES_DIR:=/usr/share/freeswitch/examples
FS_LIB_DIR:=/usr/lib
FS_MOD_DIR:=$(FS_LIB_DIR)/freeswitch/mod
FS_PKGCONFIG_DIR:=$(FS_LIB_DIR)/pkgconfig
PKG_CONFIG_DEPENDS:= \
CONFIG_FREETDM_WITH_DEBUG \
CONFIG_FS_WITH_MODCONF \
CONFIG_LIBC \
CONFIG_PACKAGE_libfreetdm-ftmod-libpri \
CONFIG_PACKAGE_libfreetdm-ftmod-pritap \
include $(INCLUDE_DIR)/package.mk
define Package/libfreetdm/install/ftmod
$(INSTALL_DIR) $(1)$(FS_MOD_DIR)
$(INSTALL_BIN) $(PKG_INSTALL_DIR)$(FS_MOD_DIR)/ftmod_$(2).so \
$(1)$(FS_MOD_DIR)
endef
define Package/freetdm/config
source "$(SOURCE)/Config.in"
endef
define Package/libfreetdm/Default
SECTION:=libs
CATEGORY:=Libraries
SUBMENU:=Telephony
URL:=https://www.freeswitch.org
endef
define Package/libfreetdm
$(call Package/libfreetdm/Default)
DEPENDS:=
TITLE:=TDM signaling and media API
MENU:=1
endef
define Package/libfreetdm/description
Provides a unified interface to hardware TDM cards and SS7 stacks.
endef
define Package/libfreetdm/install
$(INSTALL_DIR) $(1)$(FS_LIB_DIR)
$(CP) $(PKG_INSTALL_DIR)$(FS_LIB_DIR)/libfreetdm.so.* \
$(1)$(FS_LIB_DIR)
endef
define Package/freeswitch-mod-freetdm
$(call Package/libfreetdm/Default)
SECTION:=net
CATEGORY:=Network
SUBMENU:=Telephony
DEPENDS:=freeswitch +libfreetdm
TITLE:=FreeTDM endpoint module
endef
define Package/freeswitch-mod-freetdm/description
This module is the glue between FreeSWITCH and FreeTDM.
endef
define Package/freeswitch-mod-freetdm/install
$(INSTALL_DIR) $(1)$(FS_MOD_DIR)
$(INSTALL_BIN) $(PKG_INSTALL_DIR)$(FS_MOD_DIR)/mod_freetdm.so \
$(1)$(FS_MOD_DIR)
ifeq ($(CONFIG_FS_WITH_MODCONF),y)
$(INSTALL_DIR) \
$(1)$(FS_EXAMPLES_DIR)/mod_freetdm/freeswitch/autoload_configs
$(INSTALL_DATA) $(PKG_INSTALL_DIR)/etc/*.conf \
$(1)$(FS_EXAMPLES_DIR)/mod_freetdm
$(INSTALL_DATA) \
$(PKG_INSTALL_DIR)/etc/freeswitch/autoload_configs/freetdm.conf.xml \
$(1)$(FS_EXAMPLES_DIR)/mod_freetdm/freeswitch/autoload_configs
endif
endef
define Package/libfreetdm/FTModule
define Package/libfreetdm-ftmod-$(subst _,-,$(1))
$(call Package/libfreetdm/Default)
DEPENDS:=libfreetdm \
$(patsubst +%,+PACKAGE_libfreetdm-ftmod-$(subst _,-,$(1)):%,$(4))
TITLE:=$(2) FreeTDM module
endef
define Package/libfreetdm-ftmod-$(subst _,-,$(1))/description
$(subst \n,$(newline),$(3))
endef
define Package/libfreetdm-ftmod-$(subst _,-,$(1))/install
$(call Package/libfreetdm/install/ftmod,$$(1),$(1))
endef
$$(eval $$(call BuildPackage,libfreetdm-ftmod-$(subst _,-,$(1))))
endef
CONFIGURE_ARGS+= \
--srcdir=$(PKG_BUILD_DIR) \
--disable-dependency-tracking \
--disable-static \
--with-modinstdir=$(FS_MOD_DIR) \
$(call autoconf_bool,CONFIG_FREETDM_WITH_DEBUG,debug) \
$(if $(CONFIG_PACKAGE_libfreetdm-ftmod-libpri),--with-libpri="$(STAGING_DIR)/usr",--without-libpri) \
$(if $(CONFIG_PACKAGE_libfreetdm-ftmod-pritap),--with-pritap,--without-pritap)
$(eval $(call BuildPackage,libfreetdm))
$(eval $(call BuildPackage,freeswitch-mod-freetdm))
################################
# FreeTDM modules
# Params:
# 1 - Package subname
# 2 - Package title
# 3 - Module description
# 4 - Module dependencies
################################
$(eval $(call Package/libfreetdm/FTModule,analog,Analog,Offers generic FXO/FXS support for any type of card supported by FreeTDM.,))
$(eval $(call Package/libfreetdm/FTModule,analog_em,Analog EM,Offers generic E&M signaling for any type of card supported by FreeTDM.,))
$(eval $(call Package/libfreetdm/FTModule,libpri,LibPRI,Offers support for PRI lines using the open source libpri stack for any\ntype of card supported by FreeTDM. Supports both PRI and BRI signalling.,+libpri @!aarch64))
$(eval $(call Package/libfreetdm/FTModule,pritap,PRI tapping,This module is used to tap PRI lines.,+libfreetdm-ftmod-libpri))
$(eval $(call Package/libfreetdm/FTModule,skel,Skeleton,ftmod_skel is an example module.,))
$(eval $(call Package/libfreetdm/FTModule,zt,DAHDI I/O,This module supports the DAHDI interface. The DAHDI interface is used by\nseveral hardware vendors.,))

View file

@ -1,5 +1,5 @@
--- a/libs/freetdm/configure.ac
+++ b/libs/freetdm/configure.ac
--- a/configure.ac
+++ b/configure.ac
@@ -88,7 +88,7 @@ AC_ARG_ENABLE([enable_64],
case "${ax_cv_c_compiler_vendor}" in

View file

@ -1,5 +1,5 @@
--- a/libs/freetdm/mod_freetdm/Makefile.in
+++ b/libs/freetdm/mod_freetdm/Makefile.in
--- a/mod_freetdm/Makefile.in
+++ b/mod_freetdm/Makefile.in
@@ -1,4 +1,4 @@
-FT_CFLAGS=@CFLAGS@ @COMP_VENDOR_CFLAGS@ @DEFS@
+FT_CFLAGS=@COMP_VENDOR_CFLAGS@ @DEFS@

View file

@ -0,0 +1,10 @@
--- a/Makefile.am
+++ b/Makefile.am
@@ -284,6 +284,7 @@ dox doxygen:
install-data-local:
$(mkinstalldirs) $(DESTDIR)$(prefix)
$(mkinstalldirs) $(DESTDIR)@confdir@
+ $(mkinstalldirs) $(DESTDIR)@fsconfdir@/autoload_configs
@[ -f "$(DESTDIR)@confdir@/freetdm.conf" ] || ( cp conf/*.conf $(DESTDIR)@confdir@)
@[ -f "$(DESTDIR)@fsconfdir@/autoload_configs/freetdm.conf.xml" ] || ( cp -f conf/freetdm.conf.xml $(DESTDIR)@fsconfdir@/autoload_configs)
@echo FreeTDM Installed

View file

@ -9,7 +9,7 @@ include $(TOPDIR)/rules.mk
PKG_NAME:=gsmlib
PKG_VERSION:=1.10-20140304
PKG_RELEASE:=2
PKG_RELEASE:=3
PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.xz
PKG_SOURCE_URL:=https://github.com/vbouchaud/gsmlib.git
@ -63,6 +63,8 @@ define Package/gsm-utils/description
Some simple command line programs to access GSM mobile phones via GSM modems.
endef
CONFIGURE_ARGS += --disable-nls
define Build/InstallDev
$(INSTALL_DIR) $(1)/usr/include/$(PKG_NAME)
$(INSTALL_DATA) \

View file

@ -19,6 +19,15 @@ Description: Update autotools-related stuff.
dnl comment out this line to get extensive debugging output and asserts
dnl CXXFLAGS="-DNDEBUG $CXXFLAGS"
@@ -108,7 +111,7 @@ AC_SUBST(GSM_VERSION)
dnl national language support (NLS)
LINGUAS="de"
ALL_LINGUAS=$LINGUAS
-AM_GNU_GETTEXT
+AM_GNU_GETTEXT([external])
dnl AM_GLIB_GNU_GETTEXT
dnl set locale dir (FIXME there must be a better way)
--- /dev/null
+++ b/po/Makevars
@@ -0,0 +1,5 @@
@ -29,7 +38,7 @@ Description: Update autotools-related stuff.
+
--- a/Makefile.am
+++ b/Makefile.am
@@ -11,6 +11,8 @@
@@ -11,14 +11,12 @@
# * Created: 21.5.1999
# *************************************************************************
@ -38,3 +47,11 @@ Description: Update autotools-related stuff.
SUBDIRS_ = po gsmlib apps tests doc scripts win32 ext
EXTRA_DIST = gsmlib.spec
-if COMPILE_INTL
-SUBDIRS = intl $(SUBDIRS_) # po - make automake happy
-else
SUBDIRS = $(SUBDIRS_) # po intl - make automake happy
-endif
all:

View file

@ -9,12 +9,12 @@ include $(TOPDIR)/rules.mk
PKG_NAME:=libks
PKG_VERSION:=1.6.0
PKG_RELEASE:=2
PKG_VERSION:=1.7.0
PKG_RELEASE:=1
PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.gz
PKG_SOURCE_URL:=https://codeload.github.com/signalwire/libks/tar.gz/$(PKG_VERSION)?
PKG_HASH:=1638b489df1e7c4ef81ebe08c2b6256d942a2ac1b477fb36f3920b9d1f0b7166
PKG_SOURCE_URL:=https://codeload.github.com/signalwire/libks/tar.gz/v$(PKG_VERSION)?
PKG_HASH:=73c5751eadad4d3390d61b9765e9b860e0aba7336044ecf8b007dfc1818baa69
PKG_BUILD_PARALLEL:=1
CMAKE_INSTALL:=1

View file

@ -5,7 +5,7 @@
#include(cmake/cotire.cmake)
+# Declare our project, libks
+project(LibKS VERSION 1.6.0 LANGUAGES C CXX)
+project(LibKS VERSION 1.7.0 LANGUAGES C CXX)
+message("LibKS Version ${PROJECT_VERSION_MAJOR}.${PROJECT_VERSION_MINOR}")
+
# Load our common utility api and setup the platfomrm and build
@ -16,7 +16,7 @@
endif()
-# Declare our project, libks
-project(LibKS VERSION 1.6.0 LANGUAGES C CXX)
-project(LibKS VERSION 1.7.0 LANGUAGES C CXX)
-message("LibKS Version ${PROJECT_VERSION_MAJOR}.${PROJECT_VERSION_MINOR}")
-
# Set package version

View file

@ -1,99 +0,0 @@
--- a/src/include/libks/ks_ssl.h
+++ b/src/include/libks/ks_ssl.h
@@ -25,6 +25,8 @@
#include <openssl/ssl.h>
#include <openssl/engine.h>
#include <openssl/x509v3.h>
+#include <openssl/bn.h>
+#include <openssl/rsa.h>
KS_BEGIN_EXTERN_C
--- a/src/include/libks/kws.h
+++ b/src/include/libks/kws.h
@@ -22,6 +22,8 @@
#pragma once
+#include <openssl/err.h>
+
#define WEBSOCKET_GUID "258EAFA5-E914-47DA-95CA-C5AB0DC85B11"
#define B64BUFFLEN 1024
#define KWS_MAX_HEADERS 64
--- a/src/ks_ssl.c
+++ b/src/ks_ssl.c
@@ -30,6 +30,7 @@ static int ssl_count = 0;
static int is_init = 0;
static ks_bool_t skip_ssl = KS_FALSE;
+#if OPENSSL_VERSION_NUMBER < 0x10100000
static inline void ks_ssl_lock_callback(int mode, int type, char *file, int line)
{
if (mode & CRYPTO_LOCK) {
@@ -44,6 +45,7 @@ static inline unsigned long ks_ssl_thread_id(void)
{
return ks_thread_self_id();
}
+#endif
KS_DECLARE(void) ks_ssl_init_skip(ks_bool_t skip)
{
@@ -58,6 +60,7 @@ KS_DECLARE(void) ks_ssl_init_ssl_locks(void)
is_init = 1;
+#if OPENSSL_VERSION_NUMBER < 0x10100000
if (!skip_ssl) {
SSL_library_init();
SSL_load_error_strings();
@@ -81,6 +84,7 @@ KS_DECLARE(void) ks_ssl_init_ssl_locks(void)
ssl_count++;
}
+#endif
}
KS_DECLARE(void) ks_ssl_destroy_ssl_locks(void)
@@ -91,6 +95,7 @@ KS_DECLARE(void) ks_ssl_destroy_ssl_locks(void)
is_init = 0;
+#if OPENSSL_VERSION_NUMBER < 0x10100000
if (!skip_ssl) {
if (ssl_count == 1) {
CRYPTO_set_locking_callback(NULL);
@@ -111,6 +116,7 @@ KS_DECLARE(void) ks_ssl_destroy_ssl_locks(void)
ERR_free_strings();
EVP_cleanup();
}
+#endif
}
static int mkcert(X509 **x509p, EVP_PKEY **pkeyp, int bits, int serial, int days);
@@ -159,6 +165,7 @@ KS_DECLARE(int) ks_gen_cert(const char *dir, const char *file)
}
}
+#if OPENSSL_VERSION_NUMBER < 0x10100000
X509_free(x509);
EVP_PKEY_free(pkey);
@@ -169,6 +176,7 @@ KS_DECLARE(int) ks_gen_cert(const char *dir, const char *file)
//CRYPTO_mem_leaks(bio_err);
//BIO_free(bio_err);
+#endif
ks_safe_free(pvt);
@@ -231,8 +239,8 @@ static int mkcert(X509 **x509p, EVP_PKEY **pkeyp, int bits, int serial, int days
X509_set_version(x, 0);
ASN1_INTEGER_set(X509_get_serialNumber(x), serial);
- X509_gmtime_adj(X509_get_notBefore(x), -(long)60*60*24*7);
- X509_gmtime_adj(X509_get_notAfter(x), (long)60*60*24*days);
+ X509_gmtime_adj(X509_getm_notBefore(x), -(long)60*60*24*7);
+ X509_gmtime_adj(X509_getm_notAfter(x), (long)60*60*24*days);
X509_set_pubkey(x, pk);
name = X509_get_subject_name(x);

View file

@ -11,7 +11,7 @@ include $(TOPDIR)/rules.mk
PKG_NAME:=pjproject
PKG_VERSION:=2.10
PKG_RELEASE:=1
PKG_RELEASE:=7
# download "vX.Y.tar.gz" as "pjproject-vX.Y.tar.gz"
PKG_SOURCE_URL_FILE:=$(PKG_VERSION).tar.gz
@ -19,7 +19,6 @@ PKG_SOURCE:=$(PKG_NAME)-$(PKG_SOURCE_URL_FILE)
PKG_SOURCE_URL:=https://github.com/pjsip/$(PKG_NAME)/archive
PKG_HASH:=936a4c5b98601b52325463a397ddf11ab4106c6a7b04f8dc7cdd377efbb597de
PKG_INSTALL:=1
PKG_FIXUP:=autoreconf
PKG_LICENSE:=GPL-2.0
PKG_LICENSE_FILES:=COPYING
@ -95,6 +94,7 @@ CONFIGURE_ARGS+= \
TARGET_CFLAGS+=$(TARGET_CPPFLAGS)
define Build/Compile
$(MAKE) $(PKG_JOBS) -C $(PKG_BUILD_DIR) dep
$(MAKE) $(PKG_JOBS) -C $(PKG_BUILD_DIR)
endef

View file

@ -0,0 +1,32 @@
From ce18018cc17bef8f80c08686e3a7b28384ef3ba5 Mon Sep 17 00:00:00 2001
From: sauwming <ming@teluu.com>
Date: Mon, 12 Oct 2020 13:31:25 +0800
Subject: [PATCH] Fix incorrect copying of destination info when creating
CANCEL (#2546)
---
pjsip/src/pjsip/sip_util.c | 10 +++++-----
1 file changed, 5 insertions(+), 5 deletions(-)
--- a/pjsip/src/pjsip/sip_util.c
+++ b/pjsip/src/pjsip/sip_util.c
@@ -779,14 +779,14 @@ PJ_DEF(pj_status_t) pjsip_endpt_create_c
pjsip_hdr_clone(cancel_tdata->pool, req_tdata->saved_strict_route);
}
- /* Copy the destination host name from the original request */
- pj_strdup(cancel_tdata->pool, &cancel_tdata->dest_info.name,
- &req_tdata->dest_info.name);
-
- /* Finally copy the destination info from the original request */
+ /* Copy the destination info from the original request */
pj_memcpy(&cancel_tdata->dest_info, &req_tdata->dest_info,
sizeof(req_tdata->dest_info));
+ /* Finally, copy the destination host name from the original request */
+ pj_strdup(cancel_tdata->pool, &cancel_tdata->dest_info.name,
+ &req_tdata->dest_info.name);
+
/* Done.
* Return the transmit buffer containing the CANCEL request.
*/

View file

@ -0,0 +1,31 @@
--- a/pjmedia/src/pjmedia/sdp_neg.c
+++ b/pjmedia/src/pjmedia/sdp_neg.c
@@ -304,7 +304,6 @@ PJ_DEF(pj_status_t) pjmedia_sdp_neg_modi
{
pjmedia_sdp_session *new_offer;
pjmedia_sdp_session *old_offer;
- char media_used[PJMEDIA_MAX_SDP_MEDIA];
unsigned oi; /* old offer media index */
pj_status_t status;
@@ -323,8 +322,19 @@ PJ_DEF(pj_status_t) pjmedia_sdp_neg_modi
/* Change state to STATE_LOCAL_OFFER */
neg->state = PJMEDIA_SDP_NEG_STATE_LOCAL_OFFER;
+ /* When there is no active local SDP in state PJMEDIA_SDP_NEG_STATE_DONE,
+ * it means that the previous initial SDP nego must have been failed,
+ * so we'll just set the local SDP offer here.
+ */
+ if (!neg->active_local_sdp) {
+ neg->initial_sdp_tmp = NULL;
+ neg->initial_sdp = pjmedia_sdp_session_clone(pool, local);
+ neg->neg_local_sdp = pjmedia_sdp_session_clone(pool, local);
+
+ return PJ_SUCCESS;
+ }
+
/* Init vars */
- pj_bzero(media_used, sizeof(media_used));
old_offer = neg->active_local_sdp;
new_offer = pjmedia_sdp_session_clone(pool, local);

View file

@ -0,0 +1,201 @@
From bdbeb7c4b2b11efc2e59f5dee7aa4360a2bc9fff Mon Sep 17 00:00:00 2001
From: sauwming <ming@teluu.com>
Date: Thu, 22 Apr 2021 14:03:28 +0800
Subject: [PATCH 90/90] Skip unsupported digest algorithm (#2408)
Co-authored-by: Nanang Izzuddin <nanang@teluu.com>
---
pjsip/src/pjsip/sip_auth_client.c | 32 +++++--
tests/pjsua/scripts-sipp/uas-auth-two-algo.py | 7 ++
.../pjsua/scripts-sipp/uas-auth-two-algo.xml | 83 +++++++++++++++++++
3 files changed, 117 insertions(+), 5 deletions(-)
create mode 100644 tests/pjsua/scripts-sipp/uas-auth-two-algo.py
create mode 100644 tests/pjsua/scripts-sipp/uas-auth-two-algo.xml
--- a/pjsip/src/pjsip/sip_auth_client.c
+++ b/pjsip/src/pjsip/sip_auth_client.c
@@ -1042,7 +1042,7 @@ static pj_status_t process_auth( pj_pool
pjsip_hdr *hdr;
pj_status_t status;
- /* See if we have sent authorization header for this realm */
+ /* See if we have sent authorization header for this realm (and scheme) */
hdr = tdata->msg->hdr.next;
while (hdr != &tdata->msg->hdr) {
if ((hchal->type == PJSIP_H_WWW_AUTHENTICATE &&
@@ -1052,7 +1052,8 @@ static pj_status_t process_auth( pj_pool
{
sent_auth = (pjsip_authorization_hdr*) hdr;
if (pj_stricmp(&hchal->challenge.common.realm,
- &sent_auth->credential.common.realm )==0)
+ &sent_auth->credential.common.realm)==0 &&
+ pj_stricmp(&hchal->scheme, &sent_auth->scheme)==0)
{
/* If this authorization has empty response, remove it. */
if (pj_stricmp(&sent_auth->scheme, &pjsip_DIGEST_STR)==0 &&
@@ -1062,6 +1063,14 @@ static pj_status_t process_auth( pj_pool
hdr = hdr->next;
pj_list_erase(sent_auth);
continue;
+ } else
+ if (pj_stricmp(&sent_auth->scheme, &pjsip_DIGEST_STR)==0 &&
+ pj_stricmp(&sent_auth->credential.digest.algorithm,
+ &hchal->challenge.digest.algorithm)!=0)
+ {
+ /* Same 'digest' scheme but different algo */
+ hdr = hdr->next;
+ continue;
} else {
/* Found previous authorization attempt */
break;
@@ -1155,9 +1164,10 @@ PJ_DEF(pj_status_t) pjsip_auth_clt_reini
{
pjsip_tx_data *tdata;
const pjsip_hdr *hdr;
- unsigned chal_cnt;
+ unsigned chal_cnt, auth_cnt;
pjsip_via_hdr *via;
pj_status_t status;
+ pj_status_t last_auth_err;
PJ_ASSERT_RETURN(sess && rdata && old_request && new_request,
PJ_EINVAL);
@@ -1178,6 +1188,8 @@ PJ_DEF(pj_status_t) pjsip_auth_clt_reini
*/
hdr = rdata->msg_info.msg->hdr.next;
chal_cnt = 0;
+ auth_cnt = 0;
+ last_auth_err = PJSIP_EAUTHNOAUTH;
while (hdr != &rdata->msg_info.msg->hdr) {
pjsip_cached_auth *cached_auth;
const pjsip_www_authenticate_hdr *hchal;
@@ -1222,8 +1234,13 @@ PJ_DEF(pj_status_t) pjsip_auth_clt_reini
*/
status = process_auth(tdata->pool, hchal, tdata->msg->line.req.uri,
tdata, sess, cached_auth, &hauth);
- if (status != PJ_SUCCESS)
- return status;
+ if (status != PJ_SUCCESS) {
+ last_auth_err = status;
+
+ /* Process next header. */
+ hdr = hdr->next;
+ continue;
+ }
if (pj_pool_get_used_size(cached_auth->pool) >
PJSIP_AUTH_CACHED_POOL_MAX_SIZE)
@@ -1236,12 +1253,17 @@ PJ_DEF(pj_status_t) pjsip_auth_clt_reini
/* Process next header. */
hdr = hdr->next;
+ auth_cnt++;
}
/* Check if challenge is present */
if (chal_cnt == 0)
return PJSIP_EAUTHNOCHAL;
+ /* Check if any authorization header has been created */
+ if (auth_cnt == 0)
+ return last_auth_err;
+
/* Remove branch param in Via header. */
via = (pjsip_via_hdr*) pjsip_msg_find_hdr(tdata->msg, PJSIP_H_VIA, NULL);
via->branch_param.slen = 0;
--- /dev/null
+++ b/tests/pjsua/scripts-sipp/uas-auth-two-algo.py
@@ -0,0 +1,7 @@
+# $Id$
+#
+import inc_const as const
+
+PJSUA = ["--null-audio --max-calls=1 --id=sip:a@localhost --username=a --realm=* --registrar=$SIPP_URI"]
+
+PJSUA_EXPECTS = [[0, "registration success", ""]]
--- /dev/null
+++ b/tests/pjsua/scripts-sipp/uas-auth-two-algo.xml
@@ -0,0 +1,83 @@
+<?xml version="1.0" encoding="ISO-8859-1" ?>
+<!DOCTYPE scenario SYSTEM "sipp.dtd">
+
+<scenario name="Basic UAS responder">
+ <recv request="REGISTER" crlf="true">
+ </recv>
+
+ <send>
+ <![CDATA[
+ SIP/2.0 100 Trying
+ [last_Via:];received=1.1.1.1;rport=1111
+ [last_From:]
+ [last_To:];tag=[call_number]
+ [last_Call-ID:]
+ [last_CSeq:]
+ Content-Length: 0
+ ]]>
+ </send>
+
+ <send>
+ <![CDATA[
+ SIP/2.0 401 Unauthorized
+ [last_Via:];received=1.1.1.1;rport=1111
+ [last_From:]
+ [last_To:];tag=[call_number]
+ [last_Call-ID:]
+ [last_CSeq:]
+ WWW-Authenticate: Digest realm="sip.linphone.org", nonce="PARV4gAAAADgw3asAADW8zsi5BEAAAAA", opaque="+GNywA==", algorithm=SHA-256, qop="auth"
+ WWW-Authenticate: Digest realm="sip.linphone.org", nonce="PARV4gAAAADgw3asAADW8zsi5BEAAAAA", opaque="+GNywA==", algorithm=MD5, qop="auth"
+ WWW-Authenticate: Digest realm="sip.linphone.org", nonce="PARV4gAAAADgw3asAADW8zsi5BEAAAAA", opaque="+GNywA==", algorithm=MD2, qop="auth"
+ Content-Length: 0
+ ]]>
+ </send>
+
+ <recv request="REGISTER" crlf="true">
+ <action>
+ <ereg regexp=".*"
+ search_in="hdr"
+ header="Authorization:"
+ assign_to="have_auth" />
+ </action>
+ </recv>
+
+ <nop next="resp_okay" test="have_auth" />
+
+ <send next="end">
+ <![CDATA[
+ SIP/2.0 403 no auth
+ [last_Via:];received=1.1.1.1;rport=1111
+ [last_From:]
+ [last_To:];tag=[call_number]
+ [last_Call-ID:]
+ [last_CSeq:]
+ [last_Contact:]
+ Content-Length: 0
+ ]]>
+ </send>
+
+ <label id="resp_okay" />
+
+ <send>
+ <![CDATA[
+ SIP/2.0 200 OK
+ [last_Via:];received=1.1.1.1;rport=1111
+ [last_From:]
+ [last_To:];tag=[call_number]
+ [last_Call-ID:]
+ [last_CSeq:]
+ [last_Contact:]
+ Content-Length: 0
+ ]]>
+ </send>
+
+ <label id="end" />
+
+ <!-- definition of the response time repartition table (unit is ms) -->
+ <ResponseTimeRepartition value="10, 20, 30, 40, 50, 100, 150, 200"/>
+
+ <!-- definition of the call length repartition table (unit is ms) -->
+ <CallLengthRepartition value="10, 50, 100, 500, 1000, 5000, 10000"/>
+
+</scenario>
+

View file

@ -0,0 +1,78 @@
commit f0ff5817d0647bdecd1ec99488db9378e304cf83
Author: sauwming <ming@teluu.com>
Date: Mon May 17 09:56:27 2021 +0800
Fix double free of stun session (#2709)
--- a/pjnath/include/pjnath/stun_session.h
+++ b/pjnath/include/pjnath/stun_session.h
@@ -341,6 +341,7 @@ struct pj_stun_tx_data
pj_pool_t *pool; /**< Pool. */
pj_stun_session *sess; /**< The STUN session. */
pj_stun_msg *msg; /**< The STUN message. */
+ pj_bool_t is_destroying; /**< Is destroying? */
void *token; /**< The token. */
--- a/pjnath/src/pjnath/stun_session.c
+++ b/pjnath/src/pjnath/stun_session.c
@@ -167,16 +167,27 @@ static void tdata_on_destroy(void *arg)
{
pj_stun_tx_data *tdata = (pj_stun_tx_data*)arg;
+ if (tdata->grp_lock) {
+ pj_grp_lock_dec_ref(tdata->sess->grp_lock);
+ }
+
pj_pool_safe_release(&tdata->pool);
}
static void destroy_tdata(pj_stun_tx_data *tdata, pj_bool_t force)
{
- TRACE_((THIS_FILE, "tdata %p destroy request, force=%d, tsx=%p", tdata,
- force, tdata->client_tsx));
+ TRACE_((THIS_FILE,
+ "tdata %p destroy request, force=%d, tsx=%p, destroying=%d",
+ tdata, force, tdata->client_tsx, tdata->is_destroying));
+
+ /* Just return if destroy has been requested before */
+ if (tdata->is_destroying)
+ return;
/* STUN session may have been destroyed, except when tdata is cached. */
+ tdata->is_destroying = PJ_TRUE;
+
if (tdata->res_timer.id != PJ_FALSE) {
pj_timer_heap_cancel_if_active(tdata->sess->cfg->timer_heap,
&tdata->res_timer, PJ_FALSE);
@@ -189,7 +200,6 @@ static void destroy_tdata(pj_stun_tx_dat
pj_stun_client_tsx_set_data(tdata->client_tsx, NULL);
}
if (tdata->grp_lock) {
- pj_grp_lock_dec_ref(tdata->sess->grp_lock);
pj_grp_lock_dec_ref(tdata->grp_lock);
} else {
tdata_on_destroy(tdata);
@@ -200,11 +210,11 @@ static void destroy_tdata(pj_stun_tx_dat
/* "Probably" this is to absorb retransmission */
pj_time_val delay = {0, 300};
pj_stun_client_tsx_schedule_destroy(tdata->client_tsx, &delay);
+ tdata->is_destroying = PJ_FALSE;
} else {
pj_list_erase(tdata);
if (tdata->grp_lock) {
- pj_grp_lock_dec_ref(tdata->sess->grp_lock);
pj_grp_lock_dec_ref(tdata->grp_lock);
} else {
tdata_on_destroy(tdata);
@@ -238,7 +248,7 @@ static void on_cache_timeout(pj_timer_he
sess = tdata->sess;
pj_grp_lock_acquire(sess->grp_lock);
- if (sess->is_destroying) {
+ if (sess->is_destroying || tdata->is_destroying) {
pj_grp_lock_release(sess->grp_lock);
return;
}

View file

@ -0,0 +1,162 @@
From bb92c97ea512aa0ef316c9b2335c7d57b84dfc9a Mon Sep 17 00:00:00 2001
From: Nanang Izzuddin <nanang@teluu.com>
Date: Wed, 16 Jun 2021 12:12:35 +0700
Subject: [PATCH 1/2] - Avoid SSL socket parent/listener getting destroyed
during handshake by increasing parent's reference count. - Add missing SSL
socket close when the newly accepted SSL socket is discarded in SIP TLS
transport.
---
pjlib/src/pj/ssl_sock_imp_common.c | 44 +++++++++++++++++++++--------
pjsip/src/pjsip/sip_transport_tls.c | 23 ++++++++++++++-
2 files changed, 55 insertions(+), 12 deletions(-)
--- a/pjlib/src/pj/ssl_sock_imp_common.c
+++ b/pjlib/src/pj/ssl_sock_imp_common.c
@@ -224,6 +224,8 @@ static pj_bool_t on_handshake_complete(p
/* Accepting */
if (ssock->is_server) {
+ pj_bool_t ret = PJ_TRUE;
+
if (status != PJ_SUCCESS) {
/* Handshake failed in accepting, destroy our self silently. */
@@ -241,6 +243,12 @@ static pj_bool_t on_handshake_complete(p
status);
}
+ /* Decrement ref count of parent */
+ if (ssock->parent->param.grp_lock) {
+ pj_grp_lock_dec_ref(ssock->parent->param.grp_lock);
+ ssock->parent = NULL;
+ }
+
/* Originally, this is a workaround for ticket #985. However,
* a race condition may occur in multiple worker threads
* environment when we are destroying SSL objects while other
@@ -284,23 +292,29 @@ static pj_bool_t on_handshake_complete(p
return PJ_FALSE;
}
+
/* Notify application the newly accepted SSL socket */
if (ssock->param.cb.on_accept_complete2) {
- pj_bool_t ret;
ret = (*ssock->param.cb.on_accept_complete2)
(ssock->parent, ssock, (pj_sockaddr_t*)&ssock->rem_addr,
pj_sockaddr_get_len((pj_sockaddr_t*)&ssock->rem_addr),
status);
- if (ret == PJ_FALSE)
- return PJ_FALSE;
} else if (ssock->param.cb.on_accept_complete) {
- pj_bool_t ret;
ret = (*ssock->param.cb.on_accept_complete)
(ssock->parent, ssock, (pj_sockaddr_t*)&ssock->rem_addr,
pj_sockaddr_get_len((pj_sockaddr_t*)&ssock->rem_addr));
- if (ret == PJ_FALSE)
- return PJ_FALSE;
}
+
+ /* Decrement ref count of parent and reset parent (we don't need it
+ * anymore, right?).
+ */
+ if (ssock->parent->param.grp_lock) {
+ pj_grp_lock_dec_ref(ssock->parent->param.grp_lock);
+ ssock->parent = NULL;
+ }
+
+ if (ret == PJ_FALSE)
+ return PJ_FALSE;
}
/* Connecting */
@@ -864,9 +878,13 @@ static pj_bool_t asock_on_accept_complet
if (status != PJ_SUCCESS)
goto on_return;
+ /* Set parent and add ref count (avoid parent destroy during handshake) */
+ ssock->parent = ssock_parent;
+ if (ssock->parent->param.grp_lock)
+ pj_grp_lock_add_ref(ssock->parent->param.grp_lock);
+
/* Update new SSL socket attributes */
ssock->sock = newsock;
- ssock->parent = ssock_parent;
ssock->is_server = PJ_TRUE;
if (ssock_parent->cert) {
status = pj_ssl_sock_set_certificate(ssock, ssock->pool,
@@ -913,16 +931,20 @@ static pj_bool_t asock_on_accept_complet
ssock->asock_rbuf = (void**)pj_pool_calloc(ssock->pool,
ssock->param.async_cnt,
sizeof(void*));
- if (!ssock->asock_rbuf)
- return PJ_ENOMEM;
+ if (!ssock->asock_rbuf) {
+ status = PJ_ENOMEM;
+ goto on_return;
+ }
for (i = 0; i<ssock->param.async_cnt; ++i) {
- ssock->asock_rbuf[i] = (void*) pj_pool_alloc(
+ ssock->asock_rbuf[i] = (void*) pj_pool_alloc(
ssock->pool,
ssock->param.read_buffer_size +
sizeof(read_data_t*));
- if (!ssock->asock_rbuf[i])
- return PJ_ENOMEM;
+ if (!ssock->asock_rbuf[i]) {
+ status = PJ_ENOMEM;
+ goto on_return;
+ }
}
/* Create active socket */
--- a/pjsip/src/pjsip/sip_transport_tls.c
+++ b/pjsip/src/pjsip/sip_transport_tls.c
@@ -1325,9 +1325,26 @@ static pj_bool_t on_accept_complete2(pj_
PJ_UNUSED_ARG(src_addr_len);
listener = (struct tls_listener*) pj_ssl_sock_get_user_data(ssock);
+ if (!listener) {
+ /* Listener already destroyed, e.g: after TCP accept but before SSL
+ * handshake is completed.
+ */
+ if (new_ssock && accept_status == PJ_SUCCESS) {
+ /* Close the SSL socket if the accept op is successful */
+ PJ_LOG(4,(THIS_FILE,
+ "Incoming TLS connection from %s (sock=%d) is discarded "
+ "because listener is already destroyed",
+ pj_sockaddr_print(src_addr, addr, sizeof(addr), 3),
+ new_ssock));
+
+ pj_ssl_sock_close(new_ssock);
+ }
+
+ return PJ_FALSE;
+ }
if (accept_status != PJ_SUCCESS) {
- if (listener && listener->tls_setting.on_accept_fail_cb) {
+ if (listener->tls_setting.on_accept_fail_cb) {
pjsip_tls_on_accept_fail_param param;
pj_ssl_sock_info ssi;
@@ -1350,6 +1367,8 @@ static pj_bool_t on_accept_complete2(pj_
PJ_ASSERT_RETURN(new_ssock, PJ_TRUE);
if (!listener->is_registered) {
+ pj_ssl_sock_close(new_ssock);
+
if (listener->tls_setting.on_accept_fail_cb) {
pjsip_tls_on_accept_fail_param param;
pj_bzero(&param, sizeof(param));
@@ -1401,6 +1420,8 @@ static pj_bool_t on_accept_complete2(pj_
ssl_info.grp_lock, &tls);
if (status != PJ_SUCCESS) {
+ pj_ssl_sock_close(new_ssock);
+
if (listener->tls_setting.on_accept_fail_cb) {
pjsip_tls_on_accept_fail_param param;
pj_bzero(&param, sizeof(param));

View file

@ -0,0 +1,132 @@
From 68c69f516f95df1faa42e5647e9ce7cfdc41ac38 Mon Sep 17 00:00:00 2001
From: Nanang Izzuddin <nanang@teluu.com>
Date: Wed, 16 Jun 2021 12:15:29 +0700
Subject: [PATCH 2/2] - Fix silly mistake: accepted active socket created
without group lock in SSL socket. - Replace assertion with normal validation
check of SSL socket instance in OpenSSL verification callback (verify_cb())
to avoid crash, e.g: if somehow race condition with SSL socket destroy
happens or OpenSSL application data index somehow gets corrupted.
---
pjlib/src/pj/ssl_sock_imp_common.c | 3 +-
pjlib/src/pj/ssl_sock_ossl.c | 45 +++++++++++++++++++++++++-----
2 files changed, 40 insertions(+), 8 deletions(-)
--- a/pjlib/src/pj/ssl_sock_imp_common.c
+++ b/pjlib/src/pj/ssl_sock_imp_common.c
@@ -949,6 +949,7 @@ static pj_bool_t asock_on_accept_complet
/* Create active socket */
pj_activesock_cfg_default(&asock_cfg);
+ asock_cfg.grp_lock = ssock->param.grp_lock;
asock_cfg.async_cnt = ssock->param.async_cnt;
asock_cfg.concurrency = ssock->param.concurrency;
asock_cfg.whole_data = PJ_TRUE;
@@ -964,7 +965,7 @@ static pj_bool_t asock_on_accept_complet
goto on_return;
pj_grp_lock_add_ref(glock);
- asock_cfg.grp_lock = ssock->param.grp_lock = glock;
+ ssock->param.grp_lock = glock;
pj_grp_lock_add_handler(ssock->param.grp_lock, ssock->pool, ssock,
ssl_on_destroy);
}
--- a/pjlib/src/pj/ssl_sock_ossl.c
+++ b/pjlib/src/pj/ssl_sock_ossl.c
@@ -327,7 +327,8 @@ static pj_status_t STATUS_FROM_SSL_ERR(c
ERROR_LOG("STATUS_FROM_SSL_ERR", err, ssock);
}
- ssock->last_err = err;
+ if (ssock)
+ ssock->last_err = err;
return GET_STATUS_FROM_SSL_ERR(err);
}
@@ -344,7 +345,8 @@ static pj_status_t STATUS_FROM_SSL_ERR2(
/* Dig for more from OpenSSL error queue */
SSLLogErrors(action, ret, err, len, ssock);
- ssock->last_err = ssl_err;
+ if (ssock)
+ ssock->last_err = ssl_err;
return GET_STATUS_FROM_SSL_ERR(ssl_err);
}
@@ -587,6 +589,13 @@ static pj_status_t init_openssl(void)
/* Create OpenSSL application data index for SSL socket */
sslsock_idx = SSL_get_ex_new_index(0, "SSL socket", NULL, NULL, NULL);
+ if (sslsock_idx == -1) {
+ status = STATUS_FROM_SSL_ERR2("Init", NULL, -1, ERR_get_error(), 0);
+ PJ_LOG(1,(THIS_FILE,
+ "Fatal error: failed to get application data index for "
+ "SSL socket"));
+ return status;
+ }
return status;
}
@@ -614,21 +623,36 @@ static int password_cb(char *buf, int nu
}
-/* SSL password callback. */
+/* SSL certificate verification result callback.
+ * Note that this callback seems to be always called from library worker
+ * thread, e.g: active socket on_read_complete callback, which should have
+ * already been equipped with race condition avoidance mechanism (should not
+ * be destroyed while callback is being invoked).
+ */
static int verify_cb(int preverify_ok, X509_STORE_CTX *x509_ctx)
{
- pj_ssl_sock_t *ssock;
- SSL *ossl_ssl;
+ pj_ssl_sock_t *ssock = NULL;
+ SSL *ossl_ssl = NULL;
int err;
/* Get SSL instance */
ossl_ssl = X509_STORE_CTX_get_ex_data(x509_ctx,
SSL_get_ex_data_X509_STORE_CTX_idx());
- pj_assert(ossl_ssl);
+ if (!ossl_ssl) {
+ PJ_LOG(1,(THIS_FILE,
+ "SSL verification callback failed to get SSL instance"));
+ goto on_return;
+ }
/* Get SSL socket instance */
ssock = SSL_get_ex_data(ossl_ssl, sslsock_idx);
- pj_assert(ssock);
+ if (!ssock) {
+ /* SSL socket may have been destroyed */
+ PJ_LOG(1,(THIS_FILE,
+ "SSL verification callback failed to get SSL socket "
+ "instance (sslsock_idx=%d).", sslsock_idx));
+ goto on_return;
+ }
/* Store verification status */
err = X509_STORE_CTX_get_error(x509_ctx);
@@ -706,6 +730,7 @@ static int verify_cb(int preverify_ok, X
if (PJ_FALSE == ssock->param.verify_peer)
preverify_ok = 1;
+on_return:
return preverify_ok;
}
@@ -1213,6 +1238,12 @@ static void ssl_destroy(pj_ssl_sock_t *s
static void ssl_reset_sock_state(pj_ssl_sock_t *ssock)
{
ossl_sock_t *ossock = (ossl_sock_t *)ssock;
+
+ /* Detach from SSL instance */
+ if (ossock->ossl_ssl) {
+ SSL_set_ex_data(ossock->ossl_ssl, sslsock_idx, NULL);
+ }
+
/**
* Avoid calling SSL_shutdown() if handshake wasn't completed.
* OpenSSL 1.0.2f complains if SSL_shutdown() is called during an

View file

@ -0,0 +1,27 @@
From 2ae784030b0d9cf217c3d562af20e4967f19a3dc Mon Sep 17 00:00:00 2001
From: George Joseph <gjoseph@sangoma.com>
Date: Tue, 14 Sep 2021 10:47:29 -0600
Subject: [PATCH] pjmedia_sdp_attr_get_rtpmap: Strip param trailing whitespace
Use pj_scan_get() to parse the param part of rtpmap so
trailing whitespace is automatically stripped.
Fixes #2827
---
pjmedia/src/pjmedia/sdp.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
--- a/pjmedia/src/pjmedia/sdp.c
+++ b/pjmedia/src/pjmedia/sdp.c
@@ -313,9 +313,9 @@ PJ_DEF(pj_status_t) pjmedia_sdp_attr_get
/* Expecting either '/' or EOF */
if (*scanner.curptr == '/') {
+ /* Skip the '/' */
pj_scan_get_char(&scanner);
- rtpmap->param.ptr = scanner.curptr;
- rtpmap->param.slen = scanner.end - scanner.curptr;
+ pj_scan_get(&scanner, &cs_token, &rtpmap->param);
} else {
rtpmap->param.slen = 0;
}

View file

@ -0,0 +1,653 @@
From 0ed41eb5fd0e4192e1b7dc374f819d17aef3e805 Mon Sep 17 00:00:00 2001
From: George Joseph <gtjoseph@users.noreply.github.com>
Date: Tue, 21 Dec 2021 19:32:22 -0700
Subject: [PATCH] sip_inv: Additional multipart support (#2919) (#2920)
---
pjsip/include/pjsip-ua/sip_inv.h | 108 ++++++++++-
pjsip/src/pjsip-ua/sip_inv.c | 240 ++++++++++++++++++++-----
pjsip/src/test/inv_offer_answer_test.c | 103 ++++++++++-
3 files changed, 394 insertions(+), 57 deletions(-)
--- a/pjsip/include/pjsip-ua/sip_inv.h
+++ b/pjsip/include/pjsip-ua/sip_inv.h
@@ -451,11 +451,11 @@ struct pjsip_inv_session
/**
- * This structure represents SDP information in a pjsip_rx_data. Application
- * retrieve this information by calling #pjsip_rdata_get_sdp_info(). This
+ * This structure represents SDP information in a pjsip_(rx|tx)_data. Application
+ * retrieve this information by calling #pjsip_get_sdp_info(). This
* mechanism supports multipart message body.
*/
-typedef struct pjsip_rdata_sdp_info
+typedef struct pjsip_sdp_info
{
/**
* Pointer and length of the text body in the incoming message. If
@@ -475,7 +475,15 @@ typedef struct pjsip_rdata_sdp_info
*/
pjmedia_sdp_session *sdp;
-} pjsip_rdata_sdp_info;
+} pjsip_sdp_info;
+
+/**
+ * For backwards compatibility and completeness,
+ * pjsip_rdata_sdp_info and pjsip_tdata_sdp_info
+ * are typedef'd to pjsip_sdp_info.
+ */
+typedef pjsip_sdp_info pjsip_rdata_sdp_info;
+typedef pjsip_sdp_info pjsip_tdata_sdp_info;
/**
@@ -1046,6 +1054,44 @@ PJ_DECL(pj_status_t) pjsip_create_sdp_bo
pjsip_msg_body **p_body);
/**
+ * This is a utility function to create a multipart body with the
+ * SIP body as the first part.
+ *
+ * @param pool Pool to allocate memory.
+ * @param sdp SDP session to be put in the SIP message body.
+ * @param p_body Pointer to receive SIP message body containing
+ * the SDP session.
+ *
+ * @return PJ_SUCCESS on success.
+ */
+PJ_DECL(pj_status_t) pjsip_create_multipart_sdp_body( pj_pool_t *pool,
+ pjmedia_sdp_session *sdp,
+ pjsip_msg_body **p_body);
+
+/**
+ * Retrieve SDP information from a message body. Application should
+ * prefer to use this function rather than parsing the SDP manually since
+ * this function supports multipart message body.
+ *
+ * This function will only parse the SDP once, the first time it is called
+ * on the same message. Subsequent call on the same message will just pick
+ * up the already parsed SDP from the message.
+ *
+ * @param pool Pool to allocate memory.
+ * @param body The message body.
+ * @param msg_media_type From the rdata or tdata Content-Type header, if available.
+ * If NULL, the content_type from the body will be used.
+ * @param search_media_type The media type to search for.
+ * If NULL, "application/sdp" will be used.
+ *
+ * @return The SDP info.
+ */
+PJ_DECL(pjsip_sdp_info*) pjsip_get_sdp_info(pj_pool_t *pool,
+ pjsip_msg_body *body,
+ pjsip_media_type *msg_media_type,
+ const pjsip_media_type *search_media_type);
+
+/**
* Retrieve SDP information from an incoming message. Application should
* prefer to use this function rather than parsing the SDP manually since
* this function supports multipart message body.
@@ -1061,6 +1107,60 @@ PJ_DECL(pj_status_t) pjsip_create_sdp_bo
PJ_DECL(pjsip_rdata_sdp_info*) pjsip_rdata_get_sdp_info(pjsip_rx_data *rdata);
+/**
+ * Retrieve SDP information from an incoming message. Application should
+ * prefer to use this function rather than parsing the SDP manually since
+ * this function supports multipart message body.
+ *
+ * This function will only parse the SDP once, the first time it is called
+ * on the same message. Subsequent call on the same message will just pick
+ * up the already parsed SDP from the message.
+ *
+ * @param rdata The incoming message.
+ * @param search_media_type The SDP media type to search for.
+ * If NULL, "application/sdp" will be used.
+ *
+ * @return The SDP info.
+ */
+PJ_DECL(pjsip_rdata_sdp_info*) pjsip_rdata_get_sdp_info2(
+ pjsip_rx_data *rdata,
+ const pjsip_media_type *search_media_type);
+
+/**
+ * Retrieve SDP information from an outgoing message. Application should
+ * prefer to use this function rather than parsing the SDP manually since
+ * this function supports multipart message body.
+ *
+ * This function will only parse the SDP once, the first time it is called
+ * on the same message. Subsequent call on the same message will just pick
+ * up the already parsed SDP from the message.
+ *
+ * @param tdata The outgoing message.
+ *
+ * @return The SDP info.
+ */
+PJ_DECL(pjsip_tdata_sdp_info*) pjsip_tdata_get_sdp_info(pjsip_tx_data *tdata);
+
+/**
+ * Retrieve SDP information from an outgoing message. Application should
+ * prefer to use this function rather than parsing the SDP manually since
+ * this function supports multipart message body.
+ *
+ * This function will only parse the SDP once, the first time it is called
+ * on the same message. Subsequent call on the same message will just pick
+ * up the already parsed SDP from the message.
+ *
+ * @param tdata The outgoing message.
+ * @param search_media_type The SDP media type to search for.
+ * If NULL, "application/sdp" will be used.
+ *
+ * @return The SDP info.
+ */
+PJ_DECL(pjsip_tdata_sdp_info*) pjsip_tdata_get_sdp_info2(
+ pjsip_tx_data *tdata,
+ const pjsip_media_type *search_media_type);
+
+
PJ_END_DECL
/**
--- a/pjsip/src/pjsip-ua/sip_inv.c
+++ b/pjsip/src/pjsip-ua/sip_inv.c
@@ -118,6 +118,8 @@ static pj_status_t handle_timer_response
static pj_bool_t inv_check_secure_dlg(pjsip_inv_session *inv,
pjsip_event *e);
+static int print_sdp(pjsip_msg_body *body, char *buf, pj_size_t len);
+
static void (*inv_state_handler[])( pjsip_inv_session *inv, pjsip_event *e) =
{
&inv_on_state_null,
@@ -956,66 +958,170 @@ PJ_DEF(pj_status_t) pjsip_inv_create_uac
return PJ_SUCCESS;
}
-PJ_DEF(pjsip_rdata_sdp_info*) pjsip_rdata_get_sdp_info(pjsip_rx_data *rdata)
-{
- pjsip_rdata_sdp_info *sdp_info;
- pjsip_msg_body *body = rdata->msg_info.msg->body;
- pjsip_ctype_hdr *ctype_hdr = rdata->msg_info.ctype;
- pjsip_media_type app_sdp;
+PJ_DEF(pjsip_sdp_info*) pjsip_get_sdp_info(pj_pool_t *pool,
+ pjsip_msg_body *body,
+ pjsip_media_type *msg_media_type,
+ const pjsip_media_type *search_media_type)
+{
+ pjsip_sdp_info *sdp_info;
+ pjsip_media_type search_type;
+ pjsip_media_type multipart_mixed;
+ pjsip_media_type multipart_alternative;
+ pjsip_media_type *msg_type;
+ pj_status_t status;
- sdp_info = (pjsip_rdata_sdp_info*)
- rdata->endpt_info.mod_data[mod_inv.mod.id];
- if (sdp_info)
- return sdp_info;
+ sdp_info = PJ_POOL_ZALLOC_T(pool,
+ pjsip_sdp_info);
- sdp_info = PJ_POOL_ZALLOC_T(rdata->tp_info.pool,
- pjsip_rdata_sdp_info);
PJ_ASSERT_RETURN(mod_inv.mod.id >= 0, sdp_info);
- rdata->endpt_info.mod_data[mod_inv.mod.id] = sdp_info;
- pjsip_media_type_init2(&app_sdp, "application", "sdp");
+ if (!body) {
+ return sdp_info;
+ }
- if (body && ctype_hdr &&
- pj_stricmp(&ctype_hdr->media.type, &app_sdp.type)==0 &&
- pj_stricmp(&ctype_hdr->media.subtype, &app_sdp.subtype)==0)
+ if (msg_media_type) {
+ msg_type = msg_media_type;
+ } else {
+ if (body->content_type.type.slen == 0) {
+ return sdp_info;
+ }
+ msg_type = &body->content_type;
+ }
+
+ if (!search_media_type) {
+ pjsip_media_type_init2(&search_type, "application", "sdp");
+ } else {
+ pj_memcpy(&search_type, search_media_type, sizeof(search_type));
+ }
+
+ pjsip_media_type_init2(&multipart_mixed, "multipart", "mixed");
+ pjsip_media_type_init2(&multipart_alternative, "multipart", "alternative");
+
+ if (pjsip_media_type_cmp(msg_type, &search_type, PJ_FALSE) == 0)
{
- sdp_info->body.ptr = (char*)body->data;
- sdp_info->body.slen = body->len;
- } else if (body && ctype_hdr &&
- pj_stricmp2(&ctype_hdr->media.type, "multipart")==0 &&
- (pj_stricmp2(&ctype_hdr->media.subtype, "mixed")==0 ||
- pj_stricmp2(&ctype_hdr->media.subtype, "alternative")==0))
+ /*
+ * If the print_body function is print_sdp, we know that
+ * body->data is a pjmedia_sdp_session object and came from
+ * a tx_data. If not, it's the text representation of the
+ * sdp from an rx_data.
+ */
+ if (body->print_body == print_sdp) {
+ sdp_info->sdp = body->data;
+ } else {
+ sdp_info->body.ptr = (char*)body->data;
+ sdp_info->body.slen = body->len;
+ }
+ } else if (pjsip_media_type_cmp(&multipart_mixed, msg_type, PJ_FALSE) == 0 ||
+ pjsip_media_type_cmp(&multipart_alternative, msg_type, PJ_FALSE) == 0)
{
- pjsip_multipart_part *part;
+ pjsip_multipart_part *part;
+ part = pjsip_multipart_find_part(body, &search_type, NULL);
+ if (part) {
+ if (part->body->print_body == print_sdp) {
+ sdp_info->sdp = part->body->data;
+ } else {
+ sdp_info->body.ptr = (char*)part->body->data;
+ sdp_info->body.slen = part->body->len;
+ }
+ }
+ }
- part = pjsip_multipart_find_part(body, &app_sdp, NULL);
- if (part) {
- sdp_info->body.ptr = (char*)part->body->data;
- sdp_info->body.slen = part->body->len;
- }
+ /*
+ * If the body was already a pjmedia_sdp_session, we can just
+ * return it. If not and there wasn't a text representation
+ * of the sdp either, we can also just return.
+ */
+ if (sdp_info->sdp || !sdp_info->body.ptr) {
+ return sdp_info;
}
- if (sdp_info->body.ptr) {
- pj_status_t status;
- status = pjmedia_sdp_parse(rdata->tp_info.pool,
- sdp_info->body.ptr,
- sdp_info->body.slen,
- &sdp_info->sdp);
- if (status == PJ_SUCCESS)
- status = pjmedia_sdp_validate2(sdp_info->sdp, PJ_FALSE);
+ /*
+ * If the body was the text representation of teh SDP, we need
+ * to parse it to create a pjmedia_sdp_session object.
+ */
+ status = pjmedia_sdp_parse(pool,
+ sdp_info->body.ptr,
+ sdp_info->body.slen,
+ &sdp_info->sdp);
+ if (status == PJ_SUCCESS)
+ status = pjmedia_sdp_validate2(sdp_info->sdp, PJ_FALSE);
- if (status != PJ_SUCCESS) {
- sdp_info->sdp = NULL;
- PJ_PERROR(1,(THIS_FILE, status,
- "Error parsing/validating SDP body"));
- }
+ if (status != PJ_SUCCESS) {
+ sdp_info->sdp = NULL;
+ PJ_PERROR(1, (THIS_FILE, status,
+ "Error parsing/validating SDP body"));
+ }
+
+ sdp_info->sdp_err = status;
+
+ return sdp_info;
+}
+
+PJ_DEF(pjsip_rdata_sdp_info*) pjsip_rdata_get_sdp_info2(
+ pjsip_rx_data *rdata,
+ const pjsip_media_type *search_media_type)
+{
+ pjsip_media_type *msg_media_type = NULL;
+ pjsip_rdata_sdp_info *sdp_info;
- sdp_info->sdp_err = status;
+ if (rdata->endpt_info.mod_data[mod_inv.mod.id]) {
+ return (pjsip_rdata_sdp_info *)rdata->endpt_info.mod_data[mod_inv.mod.id];
+ }
+
+ /*
+ * rdata should have a Content-Type header at this point but we'll
+ * make sure.
+ */
+ if (rdata->msg_info.ctype) {
+ msg_media_type = &rdata->msg_info.ctype->media;
}
+ sdp_info = pjsip_get_sdp_info(rdata->tp_info.pool,
+ rdata->msg_info.msg->body,
+ msg_media_type,
+ search_media_type);
+ rdata->endpt_info.mod_data[mod_inv.mod.id] = sdp_info;
return sdp_info;
}
+PJ_DEF(pjsip_rdata_sdp_info*) pjsip_rdata_get_sdp_info(pjsip_rx_data *rdata)
+{
+ return pjsip_rdata_get_sdp_info2(rdata, NULL);
+}
+
+PJ_DEF(pjsip_tdata_sdp_info*) pjsip_tdata_get_sdp_info2(
+ pjsip_tx_data *tdata,
+ const pjsip_media_type *search_media_type)
+{
+ pjsip_ctype_hdr *ctype_hdr = NULL;
+ pjsip_media_type *msg_media_type = NULL;
+ pjsip_tdata_sdp_info *sdp_info;
+
+ if (tdata->mod_data[mod_inv.mod.id]) {
+ return (pjsip_tdata_sdp_info *)tdata->mod_data[mod_inv.mod.id];
+ }
+ /*
+ * tdata won't usually have a Content-Type header at this point
+ * but we'll check just the same,
+ */
+ ctype_hdr = pjsip_msg_find_hdr(tdata->msg, PJSIP_H_CONTENT_TYPE, NULL);
+ if (ctype_hdr) {
+ msg_media_type = &ctype_hdr->media;
+ }
+
+ sdp_info = pjsip_get_sdp_info(tdata->pool,
+ tdata->msg->body,
+ msg_media_type,
+ search_media_type);
+ tdata->mod_data[mod_inv.mod.id] = sdp_info;
+
+ return sdp_info;
+}
+
+PJ_DEF(pjsip_tdata_sdp_info*) pjsip_tdata_get_sdp_info(pjsip_tx_data *tdata)
+{
+ return pjsip_tdata_get_sdp_info2(tdata, NULL);
+}
/*
* Verify incoming INVITE request.
@@ -1740,13 +1846,55 @@ PJ_DEF(pj_status_t) pjsip_create_sdp_bod
return PJ_SUCCESS;
}
+static pjsip_multipart_part* create_sdp_part(pj_pool_t *pool, pjmedia_sdp_session *sdp)
+{
+ pjsip_multipart_part *sdp_part;
+ pjsip_media_type media_type;
+
+ pjsip_media_type_init2(&media_type, "application", "sdp");
+
+ sdp_part = pjsip_multipart_create_part(pool);
+ PJ_ASSERT_RETURN(sdp_part != NULL, NULL);
+
+ sdp_part->body = PJ_POOL_ZALLOC_T(pool, pjsip_msg_body);
+ PJ_ASSERT_RETURN(sdp_part->body != NULL, NULL);
+
+ pjsip_media_type_cp(pool, &sdp_part->body->content_type, &media_type);
+
+ sdp_part->body->data = sdp;
+ sdp_part->body->clone_data = clone_sdp;
+ sdp_part->body->print_body = print_sdp;
+
+ return sdp_part;
+}
+
+PJ_DEF(pj_status_t) pjsip_create_multipart_sdp_body(pj_pool_t *pool,
+ pjmedia_sdp_session *sdp,
+ pjsip_msg_body **p_body)
+{
+ pjsip_media_type media_type;
+ pjsip_msg_body *multipart;
+ pjsip_multipart_part *sdp_part;
+
+ pjsip_media_type_init2(&media_type, "multipart", "mixed");
+ multipart = pjsip_multipart_create(pool, &media_type, NULL);
+ PJ_ASSERT_RETURN(multipart != NULL, PJ_ENOMEM);
+
+ sdp_part = create_sdp_part(pool, sdp);
+ PJ_ASSERT_RETURN(sdp_part != NULL, PJ_ENOMEM);
+ pjsip_multipart_add_part(pool, multipart, sdp_part);
+ *p_body = multipart;
+
+ return PJ_SUCCESS;
+}
+
static pjsip_msg_body *create_sdp_body(pj_pool_t *pool,
const pjmedia_sdp_session *c_sdp)
{
pjsip_msg_body *body;
pj_status_t status;
- status = pjsip_create_sdp_body(pool,
+ status = pjsip_create_sdp_body(pool,
pjmedia_sdp_session_clone(pool, c_sdp),
&body);
@@ -2069,6 +2217,7 @@ static pj_status_t inv_check_sdp_in_inco
)
)
{
+ pjsip_sdp_info *tdata_sdp_info;
const pjmedia_sdp_session *reoffer_sdp = NULL;
PJ_LOG(4,(inv->obj_name, "Received %s response "
@@ -2077,14 +2226,15 @@ static pj_status_t inv_check_sdp_in_inco
(st_code/10==18? "early" : "final" )));
/* Retrieve original SDP offer from INVITE request */
- reoffer_sdp = (const pjmedia_sdp_session*)
- tsx->last_tx->msg->body->data;
+ tdata_sdp_info = pjsip_tdata_get_sdp_info(tsx->last_tx);
+ reoffer_sdp = tdata_sdp_info->sdp;
/* Feed the original offer to negotiator */
status = pjmedia_sdp_neg_modify_local_offer2(inv->pool_prov,
inv->neg,
inv->sdp_neg_flags,
reoffer_sdp);
+
if (status != PJ_SUCCESS) {
PJ_LOG(1,(inv->obj_name, "Error updating local offer for "
"forked 2xx/18x response (err=%d)", status));
--- a/pjsip/src/test/inv_offer_answer_test.c
+++ b/pjsip/src/test/inv_offer_answer_test.c
@@ -137,6 +137,7 @@ typedef struct inv_test_param_t
pj_bool_t need_established;
unsigned count;
oa_t oa[4];
+ pj_bool_t multipart_body;
} inv_test_param_t;
typedef struct inv_test_t
@@ -257,6 +258,17 @@ static void on_media_update(pjsip_inv_se
}
}
+ /* Special handling for standard offer/answer */
+ if (inv_test.param.count == 1 &&
+ inv_test.param.oa[0] == OFFERER_UAC &&
+ inv_test.param.need_established)
+ {
+ jobs[job_cnt].type = ESTABLISH_CALL;
+ jobs[job_cnt].who = PJSIP_ROLE_UAS;
+ job_cnt++;
+ TRACE_((THIS_FILE, " C+++"));
+ }
+
pj_assert(job_cnt <= PJ_ARRAY_SIZE(jobs));
}
}
@@ -333,6 +345,15 @@ static pj_bool_t on_rx_request(pjsip_rx_
NULL, &tdata);
pj_assert(status == PJ_SUCCESS);
+ /* Use multipart body, if configured */
+ if (sdp && inv_test.param.multipart_body) {
+ status = pjsip_create_multipart_sdp_body(
+ tdata->pool,
+ pjmedia_sdp_session_clone(tdata->pool, sdp),
+ &tdata->msg->body);
+ }
+ pj_assert(status == PJ_SUCCESS);
+
status = pjsip_inv_send_msg(inv_test.uas, tdata);
pj_assert(status == PJ_SUCCESS);
@@ -426,6 +447,7 @@ static int perform_test(inv_test_param_t
sdp = NULL;
status = pjsip_inv_create_uac(dlg, sdp, inv_test.param.inv_option, &inv_test.uac);
+ //inv_test.uac->create_multipart = param->multipart_body;
PJ_ASSERT_RETURN(status==PJ_SUCCESS, -20);
TRACE_((THIS_FILE, " Sending INVITE %s offer", (sdp ? "with" : "without")));
@@ -436,8 +458,17 @@ static int perform_test(inv_test_param_t
status = pjsip_inv_invite(inv_test.uac, &tdata);
PJ_ASSERT_RETURN(status==PJ_SUCCESS, -30);
+ /* Use multipart body, if configured */
+ if (sdp && param->multipart_body) {
+ status = pjsip_create_multipart_sdp_body(
+ tdata->pool,
+ pjmedia_sdp_session_clone(tdata->pool, sdp),
+ &tdata->msg->body);
+ }
+ PJ_ASSERT_RETURN(status==PJ_SUCCESS, -40);
+
status = pjsip_inv_send_msg(inv_test.uac, tdata);
- PJ_ASSERT_RETURN(status==PJ_SUCCESS, -30);
+ PJ_ASSERT_RETURN(status==PJ_SUCCESS, -50);
/*
* Wait until test completes
@@ -525,13 +556,14 @@ static inv_test_param_t test_params[] =
200/INVITE (answer) <--
ACK -->
*/
-#if 0
+#if 1
{
"Standard INVITE with offer",
0,
PJ_TRUE,
1,
- { OFFERER_UAC }
+ { OFFERER_UAC },
+ PJ_FALSE
},
{
@@ -539,7 +571,25 @@ static inv_test_param_t test_params[] =
PJSIP_INV_REQUIRE_100REL,
PJ_TRUE,
1,
- { OFFERER_UAC }
+ { OFFERER_UAC },
+ PJ_FALSE
+ },
+ {
+ "Standard INVITE with offer, with Multipart",
+ 0,
+ PJ_TRUE,
+ 1,
+ { OFFERER_UAC },
+ PJ_TRUE
+ },
+
+ {
+ "Standard INVITE with offer, with 100rel, with Multipart",
+ PJSIP_INV_REQUIRE_100REL,
+ PJ_TRUE,
+ 1,
+ { OFFERER_UAC },
+ PJ_TRUE
},
#endif
@@ -555,7 +605,8 @@ static inv_test_param_t test_params[] =
0,
PJ_TRUE,
1,
- { OFFERER_UAS }
+ { OFFERER_UAS },
+ PJ_FALSE
},
{
@@ -563,7 +614,25 @@ static inv_test_param_t test_params[] =
PJSIP_INV_REQUIRE_100REL,
PJ_TRUE,
1,
- { OFFERER_UAS }
+ { OFFERER_UAS },
+ PJ_FALSE
+ },
+ {
+ "INVITE with no offer, with Multipart",
+ 0,
+ PJ_TRUE,
+ 1,
+ { OFFERER_UAS },
+ PJ_TRUE
+ },
+
+ {
+ "INVITE with no offer, with 100rel, with Multipart",
+ PJSIP_INV_REQUIRE_100REL,
+ PJ_TRUE,
+ 1,
+ { OFFERER_UAS },
+ PJ_TRUE
},
#endif
@@ -584,14 +653,24 @@ static inv_test_param_t test_params[] =
0,
PJ_TRUE,
2,
- { OFFERER_UAC, OFFERER_UAC }
+ { OFFERER_UAC, OFFERER_UAC },
+ PJ_FALSE
+ },
+ {
+ "INVITE and UPDATE by UAC, with Multipart",
+ 0,
+ PJ_TRUE,
+ 2,
+ { OFFERER_UAC, OFFERER_UAC },
+ PJ_TRUE
},
{
"INVITE and UPDATE by UAC, with 100rel",
PJSIP_INV_REQUIRE_100REL,
PJ_TRUE,
2,
- { OFFERER_UAC, OFFERER_UAC }
+ { OFFERER_UAC, OFFERER_UAC },
+ PJ_FALSE
},
#endif
@@ -617,6 +696,14 @@ static inv_test_param_t test_params[] =
4,
{ OFFERER_UAC, OFFERER_UAS, OFFERER_UAC, OFFERER_UAS }
},
+ {
+ "INVITE and many UPDATE by UAC and UAS, with Multipart",
+ 0,
+ PJ_TRUE,
+ 4,
+ { OFFERER_UAC, OFFERER_UAS, OFFERER_UAC, OFFERER_UAS },
+ PJ_TRUE
+ },
};

View file

@ -0,0 +1,116 @@
From 3faf1d2b4da553bbaee04f9a13a5d084b381e5fb Mon Sep 17 00:00:00 2001
From: sauwming <ming@teluu.com>
Date: Tue, 4 Jan 2022 15:28:49 +0800
Subject: [PATCH] Fix incorrect unescaping of tokens during parsing (#2933)
---
pjsip/src/pjsip/sip_parser.c | 29 +++++++++++++++++++++++++----
pjsip/src/test/msg_test.c | 6 +++---
2 files changed, 28 insertions(+), 7 deletions(-)
--- a/pjsip/src/pjsip/sip_parser.c
+++ b/pjsip/src/pjsip/sip_parser.c
@@ -378,17 +378,23 @@ static pj_status_t init_parser()
PJ_ASSERT_RETURN(status == PJ_SUCCESS, status);
pj_cis_add_str( &pconst.pjsip_TOKEN_SPEC, TOKEN);
+ /* Token is allowed to have '%' so we do not need this. */
+ /*
status = pj_cis_dup(&pconst.pjsip_TOKEN_SPEC_ESC, &pconst.pjsip_TOKEN_SPEC);
PJ_ASSERT_RETURN(status == PJ_SUCCESS, status);
pj_cis_del_str(&pconst.pjsip_TOKEN_SPEC_ESC, "%");
+ */
status = pj_cis_dup(&pconst.pjsip_VIA_PARAM_SPEC, &pconst.pjsip_TOKEN_SPEC);
PJ_ASSERT_RETURN(status == PJ_SUCCESS, status);
pj_cis_add_str(&pconst.pjsip_VIA_PARAM_SPEC, "[:]");
+ /* Token is allowed to have '%' */
+ /*
status = pj_cis_dup(&pconst.pjsip_VIA_PARAM_SPEC_ESC, &pconst.pjsip_TOKEN_SPEC_ESC);
PJ_ASSERT_RETURN(status == PJ_SUCCESS, status);
pj_cis_add_str(&pconst.pjsip_VIA_PARAM_SPEC_ESC, "[:]");
+ */
status = pj_cis_dup(&pconst.pjsip_HOST_SPEC, &pconst.pjsip_ALNUM_SPEC);
PJ_ASSERT_RETURN(status == PJ_SUCCESS, status);
@@ -1210,7 +1216,11 @@ static void parse_param_imp( pj_scanner
unsigned option)
{
/* pname */
- parser_get_and_unescape(scanner, pool, spec, esc_spec, pname);
+ if (!esc_spec) {
+ pj_scan_get(scanner, spec, pname);
+ } else {
+ parser_get_and_unescape(scanner, pool, spec, esc_spec, pname);
+ }
/* init pvalue */
pvalue->ptr = NULL;
@@ -1240,7 +1250,12 @@ static void parse_param_imp( pj_scanner
// pj_scan_get_until_ch(scanner, ']', pvalue);
// pj_scan_get_char(scanner);
} else if(pj_cis_match(spec, *scanner->curptr)) {
- parser_get_and_unescape(scanner, pool, spec, esc_spec, pvalue);
+ if (!esc_spec) {
+ pj_scan_get(scanner, spec, pvalue);
+ } else {
+ parser_get_and_unescape(scanner, pool, spec, esc_spec,
+ pvalue);
+ }
}
}
}
@@ -1252,7 +1267,10 @@ PJ_DEF(void) pjsip_parse_param_imp(pj_sc
unsigned option)
{
parse_param_imp(scanner, pool, pname, pvalue, &pconst.pjsip_TOKEN_SPEC,
- &pconst.pjsip_TOKEN_SPEC_ESC, option);
+ // Token does not need to be unescaped.
+ // Refer to PR #2933.
+ // &pconst.pjsip_TOKEN_SPEC_ESC,
+ NULL, option);
}
@@ -2168,7 +2186,10 @@ static void int_parse_via_param( pjsip_v
pj_scan_get_char(scanner);
parse_param_imp(scanner, pool, &pname, &pvalue,
&pconst.pjsip_VIA_PARAM_SPEC,
- &pconst.pjsip_VIA_PARAM_SPEC_ESC,
+ // Token does not need to be unescaped.
+ // Refer to PR #2933.
+ // &pconst.pjsip_VIA_PARAM_SPEC_ESC,
+ NULL,
0);
if (!parser_stricmp(pname, pconst.pjsip_BRANCH_STR) && pvalue.slen) {
--- a/pjsip/src/test/msg_test.c
+++ b/pjsip/src/test/msg_test.c
@@ -953,7 +953,7 @@ static int hdr_test_subject_utf(pjsip_hd
#define GENERIC_PARAM "p0=a;p1=\"ab:;cd\";p2=ab%3acd;p3"
-#define GENERIC_PARAM_PARSED "p0=a;p1=\"ab:;cd\";p2=ab:cd;p3"
+#define GENERIC_PARAM_PARSED "p0=a;p1=\"ab:;cd\";p2=ab%3acd;p3"
#define PARAM_CHAR "][/:&+$"
#define SIMPLE_ADDR_SPEC "sip:host"
#define ADDR_SPEC SIMPLE_ADDR_SPEC ";"PARAM_CHAR"="PARAM_CHAR ";p1=\";\""
@@ -1401,7 +1401,7 @@ static int generic_param_test(pjsip_para
param = param->next;
if (pj_strcmp2(&param->name, "p2"))
return -956;
- if (pj_strcmp2(&param->value, "ab:cd"))
+ if (pj_strcmp2(&param->value, "ab%3acd"))
return -957;
param = param->next;
@@ -1621,7 +1621,7 @@ static int hdr_test_content_type(pjsip_h
prm = prm->next;
if (prm == &hdr->media.param) return -1960;
if (pj_strcmp2(&prm->name, "p2")) return -1961;
- if (pj_strcmp2(&prm->value, "ab:cd")) return -1962;
+ if (pj_strcmp2(&prm->value, "ab%3acd")) return -1962;
prm = prm->next;
if (prm == &hdr->media.param) return -1970;

View file

@ -0,0 +1,169 @@
From 7e3dfd8a15fd0f98dbf0e04d2d7a5bded90ee401 Mon Sep 17 00:00:00 2001
From: George Joseph <gjoseph@sangoma.com>
Date: Tue, 11 Jan 2022 09:27:23 -0700
Subject: [PATCH] Create generic pjsip_hdr_find functions
pjsip_msg_find_hdr(), pjsip_msg_find_hdr_by_name(), and
pjsip_msg_find_hdr_by_names() require a pjsip_msg to be passed in
so if you need to search a header list that's not in a pjsip_msg,
you have to do it yourself. This commit adds generic versions of
those 3 functions that take in the actual header list head instead
of a pjsip_msg so if you need to search a list of headers in
something like a pjsip_multipart_part, you can do so easily.
---
pjsip/include/pjsip/sip_msg.h | 53 +++++++++++++++++++++++++++++++++++
pjsip/src/pjsip/sip_msg.c | 51 +++++++++++++++++++++++----------
2 files changed, 89 insertions(+), 15 deletions(-)
--- a/pjsip/include/pjsip/sip_msg.h
+++ b/pjsip/include/pjsip/sip_msg.h
@@ -363,6 +363,59 @@ PJ_DECL(void*) pjsip_hdr_shallow_clone(
PJ_DECL(int) pjsip_hdr_print_on( void *hdr, char *buf, pj_size_t len);
/**
+ * Find a header in a header list by the header type.
+ *
+ * @param hdr_list The "head" of the header list.
+ * @param type The header type to find.
+ * @param start The first header field where the search should begin.
+ * If NULL is specified, then the search will begin from the
+ * first header, otherwise the search will begin at the
+ * specified header.
+ *
+ * @return The header field, or NULL if no header with the specified
+ * type is found.
+ */
+PJ_DECL(void*) pjsip_hdr_find( const void *hdr_list,
+ pjsip_hdr_e type,
+ const void *start);
+
+/**
+ * Find a header in a header list by its name.
+ *
+ * @param hdr_list The "head" of the header list.
+ * @param name The header name to find.
+ * @param start The first header field where the search should begin.
+ * If NULL is specified, then the search will begin from the
+ * first header, otherwise the search will begin at the
+ * specified header.
+ *
+ * @return The header field, or NULL if no header with the specified
+ * type is found.
+ */
+PJ_DECL(void*) pjsip_hdr_find_by_name( const void *hdr_list,
+ const pj_str_t *name,
+ const void *start);
+
+/**
+ * Find a header in a header list by its name and short name version.
+ *
+ * @param hdr_list The "head" of the header list.
+ * @param name The header name to find.
+ * @param sname The short name version of the header name.
+ * @param start The first header field where the search should begin.
+ * If NULL is specified, then the search will begin from the
+ * first header, otherwise the search will begin at the
+ * specified header.
+ *
+ * @return The header field, or NULL if no header with the specified
+ * type is found.
+ */
+PJ_DECL(void*) pjsip_hdr_find_by_names( const void *hdr_list,
+ const pj_str_t *name,
+ const pj_str_t *sname,
+ const void *start);
+
+/**
* @}
*/
--- a/pjsip/src/pjsip/sip_msg.c
+++ b/pjsip/src/pjsip/sip_msg.c
@@ -334,13 +334,13 @@ PJ_DEF(pjsip_msg*) pjsip_msg_clone( pj_p
return dst;
}
-PJ_DEF(void*) pjsip_msg_find_hdr( const pjsip_msg *msg,
- pjsip_hdr_e hdr_type, const void *start)
+PJ_DEF(void*) pjsip_hdr_find( const void *hdr_list,
+ pjsip_hdr_e hdr_type, const void *start)
{
- const pjsip_hdr *hdr=(const pjsip_hdr*) start, *end=&msg->hdr;
+ const pjsip_hdr *hdr=(const pjsip_hdr*) start, *end=hdr_list;
if (hdr == NULL) {
- hdr = msg->hdr.next;
+ hdr = end->next;
}
for (; hdr!=end; hdr = hdr->next) {
if (hdr->type == hdr_type)
@@ -349,14 +349,14 @@ PJ_DEF(void*) pjsip_msg_find_hdr( const
return NULL;
}
-PJ_DEF(void*) pjsip_msg_find_hdr_by_name( const pjsip_msg *msg,
- const pj_str_t *name,
- const void *start)
+PJ_DEF(void*) pjsip_hdr_find_by_name( const void *hdr_list,
+ const pj_str_t *name,
+ const void *start)
{
- const pjsip_hdr *hdr=(const pjsip_hdr*)start, *end=&msg->hdr;
+ const pjsip_hdr *hdr=(const pjsip_hdr*) start, *end=hdr_list;
if (hdr == NULL) {
- hdr = msg->hdr.next;
+ hdr = end->next;
}
for (; hdr!=end; hdr = hdr->next) {
if (pj_stricmp(&hdr->name, name) == 0)
@@ -365,15 +365,15 @@ PJ_DEF(void*) pjsip_msg_find_hdr_by_nam
return NULL;
}
-PJ_DEF(void*) pjsip_msg_find_hdr_by_names( const pjsip_msg *msg,
- const pj_str_t *name,
- const pj_str_t *sname,
- const void *start)
+PJ_DEF(void*) pjsip_hdr_find_by_names( const void *hdr_list,
+ const pj_str_t *name,
+ const pj_str_t *sname,
+ const void *start)
{
- const pjsip_hdr *hdr=(const pjsip_hdr*)start, *end=&msg->hdr;
+ const pjsip_hdr *hdr=(const pjsip_hdr*) start, *end=hdr_list;
if (hdr == NULL) {
- hdr = msg->hdr.next;
+ hdr = end->next;
}
for (; hdr!=end; hdr = hdr->next) {
if (pj_stricmp(&hdr->name, name) == 0)
@@ -384,6 +384,27 @@ PJ_DEF(void*) pjsip_msg_find_hdr_by_nam
return NULL;
}
+PJ_DEF(void*) pjsip_msg_find_hdr( const pjsip_msg *msg,
+ pjsip_hdr_e hdr_type, const void *start)
+{
+ return pjsip_hdr_find(&msg->hdr, hdr_type, start);
+}
+
+PJ_DEF(void*) pjsip_msg_find_hdr_by_name( const pjsip_msg *msg,
+ const pj_str_t *name,
+ const void *start)
+{
+ return pjsip_hdr_find_by_name(&msg->hdr, name, start);
+}
+
+PJ_DEF(void*) pjsip_msg_find_hdr_by_names( const pjsip_msg *msg,
+ const pj_str_t *name,
+ const pj_str_t *sname,
+ const void *start)
+{
+ return pjsip_hdr_find_by_names(&msg->hdr, name, sname, start);
+}
+
PJ_DEF(void*) pjsip_msg_find_remove_hdr( pjsip_msg *msg,
pjsip_hdr_e hdr_type, void *start)
{

View file

@ -0,0 +1,635 @@
From b7ecff22e77887626fd8e8608c4dd73bc7b7366f Mon Sep 17 00:00:00 2001
From: George Joseph <gjoseph@sangoma.com>
Date: Tue, 18 Jan 2022 06:14:31 -0700
Subject: [PATCH] Additional multipart improvements
Added the following APIs:
pjsip_multipart_find_part_by_header()
pjsip_multipart_find_part_by_header_str()
pjsip_multipart_find_part_by_cid_str()
pjsip_multipart_find_part_by_cid_uri()
---
pjsip/include/pjsip/sip_multipart.h | 83 ++++++++++
pjsip/src/pjsip/sip_multipart.c | 223 +++++++++++++++++++++++++++
pjsip/src/test/multipart_test.c | 225 +++++++++++++++++++++++++++-
3 files changed, 530 insertions(+), 1 deletion(-)
--- a/pjsip/include/pjsip/sip_multipart.h
+++ b/pjsip/include/pjsip/sip_multipart.h
@@ -154,6 +154,89 @@ pjsip_multipart_find_part( const pjsip_m
const pjsip_multipart_part *start);
/**
+ * Find a body inside multipart bodies which has a header matching the
+ * supplied one. Most useful for finding a part with a specific Content-ID.
+ *
+ * @param pool Memory pool to use for temp space.
+ * @param mp The multipart body.
+ * @param search_hdr Header to search for.
+ * @param start If specified, the search will begin at
+ * start->next part. Otherwise it will begin at
+ * the first part in the multipart bodies.
+ *
+ * @return The first part which has a header matching the
+ * specified one, or NULL if not found.
+ */
+PJ_DECL(pjsip_multipart_part*)
+pjsip_multipart_find_part_by_header(pj_pool_t *pool,
+ const pjsip_msg_body *mp,
+ void *search_hdr,
+ const pjsip_multipart_part *start);
+
+/**
+ * Find a body inside multipart bodies which has a header matching the
+ * supplied name and value. Most useful for finding a part with a specific
+ * Content-ID.
+ *
+ * @param pool Memory pool to use for temp space.
+ * @param mp The multipart body.
+ * @param hdr_name Header name to search for.
+ * @param hdr_value Header value search for.
+ * @param start If specified, the search will begin at
+ * start->next part. Otherwise it will begin at
+ * the first part in the multipart bodies.
+ *
+ * @return The first part which has a header matching the
+ * specified one, or NULL if not found.
+ */
+PJ_DECL(pjsip_multipart_part*)
+pjsip_multipart_find_part_by_header_str(pj_pool_t *pool,
+ const pjsip_msg_body *mp,
+ const pj_str_t *hdr_name,
+ const pj_str_t *hdr_value,
+ const pjsip_multipart_part *start);
+
+
+
+/**
+ * Find a body inside multipart bodies which has a Content-ID value matching the
+ * supplied "cid" URI in pj_str form. The "cid:" scheme will be assumed if the
+ * URL doesn't start with it. Enclosing angle brackets will also be handled
+ * correctly if they exist.
+ *
+ * @see RFC2392 Content-ID and Message-ID Uniform Resource Locators
+ *
+ * @param pool Memory pool to use for temp space.
+ * @param mp The multipart body.
+ * @param cid The "cid" URI to search for in pj_str form.
+ *
+ * @return The first part which has a Content-ID header matching the
+ * specified "cid" URI. or NULL if not found.
+ */
+PJ_DECL(pjsip_multipart_part*)
+pjsip_multipart_find_part_by_cid_str(pj_pool_t *pool,
+ const pjsip_msg_body *mp,
+ pj_str_t *cid);
+
+/**
+ * Find a body inside multipart bodies which has a Content-ID value matching the
+ * supplied "cid" URI.
+ *
+ * @see RFC2392 Content-ID and Message-ID Uniform Resource Locators
+ *
+ * @param pool Memory pool to use for temp space.
+ * @param mp The multipart body.
+ * @param cid The "cid" URI to search for.
+ *
+ * @return The first part which had a Content-ID header matching the
+ * specified "cid" URI. or NULL if not found.
+ */
+PJ_DECL(pjsip_multipart_part*)
+pjsip_multipart_find_part_by_cid_uri(pj_pool_t *pool,
+ const pjsip_msg_body *mp,
+ pjsip_other_uri *cid_uri);
+
+/**
* Parse multipart message.
*
* @param pool Memory pool.
--- a/pjsip/src/pjsip/sip_multipart.c
+++ b/pjsip/src/pjsip/sip_multipart.c
@@ -19,6 +19,7 @@
#include <pjsip/sip_multipart.h>
#include <pjsip/sip_parser.h>
#include <pjlib-util/scanner.h>
+#include <pjlib-util/string.h>
#include <pj/assert.h>
#include <pj/ctype.h>
#include <pj/errno.h>
@@ -416,6 +417,220 @@ pjsip_multipart_find_part( const pjsip_m
return NULL;
}
+/*
+ * Find a body inside multipart bodies which has the header and value.
+ */
+PJ_DEF(pjsip_multipart_part*)
+pjsip_multipart_find_part_by_header_str(pj_pool_t *pool,
+ const pjsip_msg_body *mp,
+ const pj_str_t *hdr_name,
+ const pj_str_t *hdr_value,
+ const pjsip_multipart_part *start)
+{
+ struct multipart_data *m_data;
+ pjsip_multipart_part *part;
+ pjsip_hdr *found_hdr;
+ pj_str_t found_hdr_str;
+ pj_str_t found_hdr_value;
+ pj_size_t expected_hdr_slen;
+ pj_size_t buf_size;
+ int hdr_name_len;
+#define REASONABLE_PADDING 32
+#define SEPARATOR_LEN 2
+ /* Must specify mandatory params */
+ PJ_ASSERT_RETURN(mp && hdr_name && hdr_value, NULL);
+
+ /* mp must really point to an actual multipart msg body */
+ PJ_ASSERT_RETURN(mp->print_body==&multipart_print_body, NULL);
+
+ /*
+ * We'll need to "print" each header we find to test it but
+ * allocating a buffer of PJSIP_MAX_URL_SIZE is overkill.
+ * Instead, we'll allocate one large enough to hold the search
+ * header name, the ": " separator, the search hdr value, and
+ * the NULL terminator. If we can't print the found header
+ * into that buffer then it can't be a match.
+ *
+ * Some header print functions such as generic_int require enough
+ * space to print the maximum possible header length so we'll
+ * add a reasonable amount to the print buffer size.
+ */
+ expected_hdr_slen = hdr_name->slen + SEPARATOR_LEN + hdr_value->slen;
+ buf_size = expected_hdr_slen + REASONABLE_PADDING;
+ found_hdr_str.ptr = pj_pool_alloc(pool, buf_size);
+ found_hdr_str.slen = 0;
+ hdr_name_len = hdr_name->slen + SEPARATOR_LEN;
+
+ m_data = (struct multipart_data*)mp->data;
+
+ if (start)
+ part = start->next;
+ else
+ part = m_data->part_head.next;
+
+ while (part != &m_data->part_head) {
+ found_hdr = NULL;
+ while ((found_hdr = pjsip_hdr_find_by_name(&part->hdr, hdr_name,
+ (found_hdr ? found_hdr->next : NULL))) != NULL) {
+
+ found_hdr_str.slen = pjsip_hdr_print_on((void*) found_hdr, found_hdr_str.ptr, buf_size);
+ /*
+ * If the buffer was too small (slen = -1) or the result wasn't
+ * the same length as the search header, it can't be a match.
+ */
+ if (found_hdr_str.slen != expected_hdr_slen) {
+ continue;
+ }
+ /*
+ * Set the value overlay to start at the found header value...
+ */
+ found_hdr_value.ptr = found_hdr_str.ptr + hdr_name_len;
+ found_hdr_value.slen = found_hdr_str.slen - hdr_name_len;
+ /* ...and compare it to the supplied header value. */
+ if (pj_strcmp(hdr_value, &found_hdr_value) == 0) {
+ return part;
+ }
+ }
+ part = part->next;
+ }
+ return NULL;
+#undef SEPARATOR_LEN
+#undef REASONABLE_PADDING
+}
+
+PJ_DEF(pjsip_multipart_part*)
+pjsip_multipart_find_part_by_header(pj_pool_t *pool,
+ const pjsip_msg_body *mp,
+ void *search_for,
+ const pjsip_multipart_part *start)
+{
+ struct multipart_data *m_data;
+ pjsip_hdr *search_hdr = search_for;
+ pj_str_t search_buf;
+
+ /* Must specify mandatory params */
+ PJ_ASSERT_RETURN(mp && search_hdr, NULL);
+
+ /* mp must really point to an actual multipart msg body */
+ PJ_ASSERT_RETURN(mp->print_body==&multipart_print_body, NULL);
+
+ /*
+ * Unfortunately, there isn't enough information to determine
+ * the maximum printed size of search_hdr at this point so we
+ * have to allocate a reasonable max.
+ */
+ search_buf.ptr = pj_pool_alloc(pool, PJSIP_MAX_URL_SIZE);
+ search_buf.slen = pjsip_hdr_print_on(search_hdr, search_buf.ptr, PJSIP_MAX_URL_SIZE - 1);
+ if (search_buf.slen <= 0) {
+ return NULL;
+ }
+ /*
+ * Set the header value to start after the header name plus the ":", then
+ * strip leading and trailing whitespace.
+ */
+ search_buf.ptr += (search_hdr->name.slen + 1);
+ search_buf.slen -= (search_hdr->name.slen + 1);
+ pj_strtrim(&search_buf);
+
+ return pjsip_multipart_find_part_by_header_str(pool, mp, &search_hdr->name, &search_buf, start);
+}
+
+/*
+ * Convert a Content-ID URI to it's corresponding header value.
+ * RFC2392 says...
+ * A "cid" URL is converted to the corresponding Content-ID message
+ * header by removing the "cid:" prefix, converting the % encoded
+ * character(s) to their equivalent US-ASCII characters, and enclosing
+ * the remaining parts with an angle bracket pair, "<" and ">".
+ *
+ * This implementation will accept URIs with or without the "cid:"
+ * scheme and optional angle brackets.
+ */
+static pj_str_t cid_uri_to_hdr_value(pj_pool_t *pool, pj_str_t *cid_uri)
+{
+ pj_size_t cid_len = pj_strlen(cid_uri);
+ pj_size_t alloc_len = cid_len + 2 /* for the leading and trailing angle brackets */;
+ pj_str_t uri_overlay;
+ pj_str_t cid_hdr;
+ pj_str_t hdr_overlay;
+
+ pj_strassign(&uri_overlay, cid_uri);
+ /* If the URI is already enclosed in angle brackets, remove them. */
+ if (uri_overlay.ptr[0] == '<') {
+ uri_overlay.ptr++;
+ uri_overlay.slen -= 2;
+ }
+ /* If the URI starts with the "cid:" scheme, skip over it. */
+ if (pj_strncmp2(&uri_overlay, "cid:", 4) == 0) {
+ uri_overlay.ptr += 4;
+ uri_overlay.slen -= 4;
+ }
+ /* Start building */
+ cid_hdr.ptr = pj_pool_alloc(pool, alloc_len);
+ cid_hdr.ptr[0] = '<';
+ cid_hdr.slen = 1;
+ hdr_overlay.ptr = cid_hdr.ptr + 1;
+ hdr_overlay.slen = 0;
+ pj_strcpy_unescape(&hdr_overlay, &uri_overlay);
+ cid_hdr.slen += hdr_overlay.slen;
+ cid_hdr.ptr[cid_hdr.slen] = '>';
+ cid_hdr.slen++;
+
+ return cid_hdr;
+}
+
+PJ_DEF(pjsip_multipart_part*)
+pjsip_multipart_find_part_by_cid_str(pj_pool_t *pool,
+ const pjsip_msg_body *mp,
+ pj_str_t *cid)
+{
+ struct multipart_data *m_data;
+ pjsip_multipart_part *part;
+ pjsip_generic_string_hdr *found_hdr;
+ pj_str_t found_hdr_value;
+ static pj_str_t hdr_name = { "Content-ID", 10};
+ pj_str_t hdr_value;
+
+ PJ_ASSERT_RETURN(pool && mp && cid && (pj_strlen(cid) > 0), NULL);
+
+ hdr_value = cid_uri_to_hdr_value(pool, cid);
+ if (pj_strlen(&hdr_value) == 0) {
+ return NULL;
+ }
+
+ m_data = (struct multipart_data*)mp->data;
+ part = m_data->part_head.next;
+
+ while (part != &m_data->part_head) {
+ found_hdr = NULL;
+ while ((found_hdr = pjsip_hdr_find_by_name(&part->hdr, &hdr_name,
+ (found_hdr ? found_hdr->next : NULL))) != NULL) {
+ if (pj_strcmp(&hdr_value, &found_hdr->hvalue) == 0) {
+ return part;
+ }
+ }
+ part = part->next;
+ }
+ return NULL;
+}
+
+PJ_DEF(pjsip_multipart_part*)
+pjsip_multipart_find_part_by_cid_uri(pj_pool_t *pool,
+ const pjsip_msg_body *mp,
+ pjsip_other_uri *cid_uri)
+{
+ PJ_ASSERT_RETURN(pool && mp && cid_uri, NULL);
+
+ if (pj_strcmp2(&cid_uri->scheme, "cid") != 0) {
+ return NULL;
+ }
+ /*
+ * We only need to pass the URI content so we
+ * can do that directly.
+ */
+ return pjsip_multipart_find_part_by_cid_str(pool, mp, &cid_uri->content);
+}
+
/* Parse a multipart part. "pct" is parent content-type */
static pjsip_multipart_part *parse_multipart_part(pj_pool_t *pool,
char *start,
@@ -584,6 +799,7 @@ PJ_DEF(pjsip_msg_body*) pjsip_multipart_
(int)boundary.slen, boundary.ptr));
}
+
/* Build the delimiter:
* delimiter = "--" boundary
*/
@@ -630,6 +846,8 @@ PJ_DEF(pjsip_msg_body*) pjsip_multipart_
if (*curptr=='\r') ++curptr;
if (*curptr!='\n') {
/* Expecting a newline here */
+ PJ_LOG(2, (THIS_FILE, "Failed to find newline"));
+
return NULL;
}
++curptr;
@@ -645,6 +863,7 @@ PJ_DEF(pjsip_msg_body*) pjsip_multipart_
curptr = pj_strstr(&subbody, &delim);
if (!curptr) {
/* We're really expecting end delimiter to be found. */
+ PJ_LOG(2, (THIS_FILE, "Failed to find end-delimiter"));
return NULL;
}
}
@@ -670,9 +889,13 @@ PJ_DEF(pjsip_msg_body*) pjsip_multipart_
part = parse_multipart_part(pool, start_body, end_body - start_body,
ctype);
if (part) {
+ TRACE_((THIS_FILE, "Adding part"));
pjsip_multipart_add_part(pool, body, part);
+ } else {
+ PJ_LOG(2, (THIS_FILE, "Failed to add part"));
}
}
+ TRACE_((THIS_FILE, "pjsip_multipart_parse finished: %p", body));
return body;
}
--- a/pjsip/src/test/multipart_test.c
+++ b/pjsip/src/test/multipart_test.c
@@ -28,6 +28,7 @@
typedef pj_status_t (*verify_ptr)(pj_pool_t*,pjsip_msg_body*);
static pj_status_t verify1(pj_pool_t *pool, pjsip_msg_body *body);
+static pj_status_t verify2(pj_pool_t *pool, pjsip_msg_body *body);
static struct test_t
{
@@ -68,7 +69,41 @@ static struct test_t
"This is epilogue, which should be ignored too",
&verify1
+ },
+ {
+ /* Content-type */
+ "multipart", "mixed", "12345",
+
+ /* Body: */
+ "This is the prolog, which should be ignored.\r\n"
+ "--12345\r\n"
+ "Content-Type: text/plain\r\n"
+ "Content-ID: <header1@example.org>\r\n"
+ "Content-ID: <\"header1\"@example.org>\r\n"
+ "Content-Length: 13\r\n"
+ "\r\n"
+ "has header1\r\n"
+ "--12345 \t\r\n"
+ "Content-Type: application/pidf+xml\r\n"
+ "Content-ID: <my header2@example.org>\r\n"
+ "Content-ID: <my\xffheader2@example.org>\r\n"
+ "Content-Length: 13\r\n"
+ "\r\n"
+ "has header2\r\n"
+ "--12345\r\n"
+ "Content-Type: text/plain\r\n"
+ "Content-ID: <my header3@example.org>\r\n"
+ "Content-ID: <header1@example.org>\r\n"
+ "Content-ID: <my header4@example.org>\r\n"
+ "Content-Length: 13\r\n"
+ "\r\n"
+ "has header4\r\n"
+ "--12345--\r\n"
+ "This is epilogue, which should be ignored too",
+
+ &verify2
}
+
};
static void init_media_type(pjsip_media_type *mt,
@@ -87,6 +122,192 @@ static void init_media_type(pjsip_media_
}
}
+static int verify_hdr(pj_pool_t *pool, pjsip_msg_body *multipart_body,
+ void *hdr, char *part_body)
+{
+ pjsip_media_type mt;
+ pjsip_multipart_part *part;
+ pj_str_t the_body;
+
+
+ part = pjsip_multipart_find_part_by_header(pool, multipart_body, hdr, NULL);
+ if (!part) {
+ return -1;
+ }
+
+ the_body.ptr = (char*)part->body->data;
+ the_body.slen = part->body->len;
+
+ if (pj_strcmp2(&the_body, part_body) != 0) {
+ return -2;
+ }
+
+ return 0;
+}
+
+static int verify_cid_str(pj_pool_t *pool, pjsip_msg_body *multipart_body,
+ pj_str_t cid_url, char *part_body)
+{
+ pjsip_media_type mt;
+ pjsip_multipart_part *part;
+ pj_str_t the_body;
+
+ part = pjsip_multipart_find_part_by_cid_str(pool, multipart_body, &cid_url);
+ if (!part) {
+ return -3;
+ }
+
+ the_body.ptr = (char*)part->body->data;
+ the_body.slen = part->body->len;
+
+ if (pj_strcmp2(&the_body, part_body) != 0) {
+ return -4;
+ }
+
+ return 0;
+}
+
+static int verify_cid_uri(pj_pool_t *pool, pjsip_msg_body *multipart_body,
+ pjsip_other_uri *cid_uri, char *part_body)
+{
+ pjsip_media_type mt;
+ pjsip_multipart_part *part;
+ pj_str_t the_body;
+
+ part = pjsip_multipart_find_part_by_cid_uri(pool, multipart_body, cid_uri);
+ if (!part) {
+ return -5;
+ }
+
+ the_body.ptr = (char*)part->body->data;
+ the_body.slen = part->body->len;
+
+ if (pj_strcmp2(&the_body, part_body) != 0) {
+ return -6;
+ }
+
+ return 0;
+}
+
+static pj_status_t verify2(pj_pool_t *pool, pjsip_msg_body *body)
+{
+ int rc = 0;
+ int rcbase = 300;
+ pjsip_other_uri *cid_uri;
+ pjsip_ctype_hdr *ctype_hdr = pjsip_ctype_hdr_create(pool);
+
+ ctype_hdr->media.type = pj_str("application");
+ ctype_hdr->media.subtype = pj_str("pidf+xml");
+
+ rc = verify_hdr(pool, body, ctype_hdr, "has header2");
+ if (rc) {
+ return (rc - rcbase);
+ }
+
+ rcbase += 10;
+ rc = verify_cid_str(pool, body, pj_str("cid:header1@example.org"), "has header1");
+ if (rc) {
+ return (rc - rcbase);
+ }
+
+ rcbase += 10;
+ rc = verify_cid_str(pool, body, pj_str("%22header1%22@example.org"), "has header1");
+ if (rc) {
+ return (rc - rcbase);
+ }
+
+ cid_uri = pjsip_uri_get_uri(pjsip_parse_uri(pool, "<cid:%22header1%22@example.org>",
+ strlen("<cid:%22header1%22@example.org>"), 0));
+ rcbase += 10;
+ rc = verify_cid_uri(pool, body, cid_uri, "has header1");
+ if (rc) {
+ return (rc - rcbase);
+ }
+
+ rcbase += 10;
+ rc = verify_cid_str(pool, body, pj_str("<cid:my%20header2@example.org>"), "has header2");
+ if (rc) {
+ return (rc - rcbase);
+ }
+
+ rcbase += 10;
+ rc = verify_cid_str(pool, body, pj_str("cid:my%ffheader2@example.org"), "has header2");
+ if (rc) {
+ return (rc - rcbase);
+ }
+
+ cid_uri = pjsip_uri_get_uri(pjsip_parse_uri(pool, "<cid:my%ffheader2@example.org>",
+ strlen("<cid:my%ffheader2@example.org>"), 0));
+ rcbase += 10;
+ rc = verify_cid_uri(pool, body, cid_uri, "has header2");
+ if (rc) {
+ return (rc - rcbase);
+ }
+
+ rcbase += 10;
+ rc = verify_cid_str(pool, body, pj_str("cid:my%20header3@example.org"), "has header4");
+ if (rc) {
+ return (rc - rcbase);
+ }
+
+ rcbase += 10;
+ rc = verify_cid_str(pool, body, pj_str("<cid:my%20header4@example.org>"), "has header4");
+ if (rc) {
+ return (rc - rcbase);
+ }
+
+ cid_uri = pjsip_uri_get_uri(pjsip_parse_uri(pool, "<cid:my%20header4@example.org>",
+ strlen("<cid:my%20header4@example.org>"), 0));
+ rcbase += 10;
+ rc = verify_cid_uri(pool, body, cid_uri, "has header4");
+ if (rc) {
+ return (rc - rcbase);
+ }
+
+ rcbase += 10;
+ rc = verify_cid_str(pool, body, pj_str("<my%20header3@example.org>"), "has header4");
+ if (rc) {
+ return (rc - rcbase);
+ }
+
+ /* These should all fail for malformed or missing URI */
+ rcbase += 10;
+ rc = verify_cid_str(pool, body, pj_str("cid:"), "has header4");
+ if (!rc) {
+ return (rc - rcbase);
+ }
+
+ rcbase += 10;
+ rc = verify_cid_str(pool, body, pj_str(""), "has header4");
+ if (!rc) {
+ return (rc - rcbase);
+ }
+
+ rcbase += 10;
+ rc = verify_cid_str(pool, body, pj_str("<>"), "has header4");
+ if (!rc) {
+ return (rc - rcbase);
+ }
+
+ rcbase += 10;
+ rc = verify_cid_str(pool, body, pj_str("<cid>"), "has header4");
+ if (!rc) {
+ return (rc - rcbase);
+ }
+
+ /*
+ * This is going to pass but the ' ' in the uri is un-encoded which is invalid
+ * so we should never see it.
+ */
+ rcbase += 10;
+ rc = verify_cid_str(pool, body, pj_str("cid:my header3@example.org"), "has header4");
+ if (rc) {
+ return (rc - rcbase);
+ }
+
+ return 0;
+}
+
static int verify_part(pjsip_multipart_part *part,
char *h_content_type,
char *h_content_subtype,
@@ -236,8 +457,10 @@ static int parse_test(void)
pj_strdup2_with_null(pool, &str, p_tests[i].msg);
body = pjsip_multipart_parse(pool, str.ptr, str.slen, &ctype, 0);
- if (!body)
+ if (!body) {
+ pj_pool_release(pool);
return -100;
+ }
if (p_tests[i].verify) {
rc = p_tests[i].verify(pool, body);

View file

@ -0,0 +1,21 @@
From 15663e3f37091069b8c98a7fce680dc04bc8e865 Mon Sep 17 00:00:00 2001
From: sauwming <ming@teluu.com>
Date: Tue, 10 Aug 2021 11:53:25 +0800
Subject: [PATCH] Merge pull request from GHSA-2qpg-f6wf-w984
---
pjnath/src/pjnath/stun_msg.c | 3 +++
1 file changed, 3 insertions(+)
--- a/pjnath/src/pjnath/stun_msg.c
+++ b/pjnath/src/pjnath/stun_msg.c
@@ -1763,6 +1763,9 @@ static pj_status_t decode_errcode_attr(p
/* Get pointer to the string in the message */
value.ptr = ((char*)buf + ATTR_HDR_LEN + 4);
value.slen = attr->hdr.length - 4;
+ /* Make sure the length is never negative */
+ if (value.slen < 0)
+ value.slen = 0;
/* Copy the string to the attribute */
pj_strdup(pool, &attr->reason, &value);

View file

@ -0,0 +1,109 @@
From db3235953baa56d2fb0e276ca510fefca751643f Mon Sep 17 00:00:00 2001
From: Nanang Izzuddin <nanang@teluu.com>
Date: Mon, 21 Feb 2022 06:24:52 +0700
Subject: [PATCH] Merge pull request from GHSA-ffff-m5fm-qm62
* Update pjsip_ua_unregister_dlg():
- update the hash key if the dialog being unregistered is used as hash key.
- add an assertion check to make sure that the dlg_set to be removed is valid (can be found in the hash table).
* Change hash key string comparison method.
---
pjsip/src/pjsip/sip_ua_layer.c | 48 +++++++++++++++++++++++++++++-----
1 file changed, 42 insertions(+), 6 deletions(-)
--- a/pjsip/src/pjsip/sip_ua_layer.c
+++ b/pjsip/src/pjsip/sip_ua_layer.c
@@ -65,6 +65,9 @@ struct dlg_set
/* This is the buffer to store this entry in the hash table. */
pj_hash_entry_buf ht_entry;
+ /* Entry key in the hash table */
+ pj_str_t ht_key;
+
/* List of dialog in this dialog set. */
struct dlg_set_head dlg_list;
};
@@ -321,6 +324,7 @@ PJ_DEF(pj_status_t) pjsip_ua_register_dl
* Create the dialog set and add this dialog to it.
*/
dlg_set = alloc_dlgset_node();
+ dlg_set->ht_key = dlg->local.info->tag;
pj_list_init(&dlg_set->dlg_list);
pj_list_push_back(&dlg_set->dlg_list, dlg);
@@ -328,8 +332,8 @@ PJ_DEF(pj_status_t) pjsip_ua_register_dl
/* Register the dialog set in the hash table. */
pj_hash_set_np_lower(mod_ua.dlg_table,
- dlg->local.info->tag.ptr,
- (unsigned)dlg->local.info->tag.slen,
+ dlg_set->ht_key.ptr,
+ (unsigned)dlg_set->ht_key.slen,
dlg->local.tag_hval, dlg_set->ht_entry,
dlg_set);
}
@@ -339,14 +343,15 @@ PJ_DEF(pj_status_t) pjsip_ua_register_dl
struct dlg_set *dlg_set;
dlg_set = alloc_dlgset_node();
+ dlg_set->ht_key = dlg->local.info->tag;
pj_list_init(&dlg_set->dlg_list);
pj_list_push_back(&dlg_set->dlg_list, dlg);
dlg->dlg_set = dlg_set;
pj_hash_set_np_lower(mod_ua.dlg_table,
- dlg->local.info->tag.ptr,
- (unsigned)dlg->local.info->tag.slen,
+ dlg_set->ht_key.ptr,
+ (unsigned)dlg_set->ht_key.slen,
dlg->local.tag_hval, dlg_set->ht_entry, dlg_set);
}
@@ -391,12 +396,43 @@ PJ_DEF(pj_status_t) pjsip_ua_unregister_
/* If dialog list is empty, remove the dialog set from the hash table. */
if (pj_list_empty(&dlg_set->dlg_list)) {
- pj_hash_set_lower(NULL, mod_ua.dlg_table, dlg->local.info->tag.ptr,
- (unsigned)dlg->local.info->tag.slen,
+
+ /* Verify that the dialog set is valid */
+ pj_assert(pj_hash_get_lower(mod_ua.dlg_table, dlg_set->ht_key.ptr,
+ (unsigned)dlg_set->ht_key.slen,
+ &dlg->local.tag_hval) == dlg_set);
+
+ pj_hash_set_lower(NULL, mod_ua.dlg_table, dlg_set->ht_key.ptr,
+ (unsigned)dlg_set->ht_key.slen,
dlg->local.tag_hval, NULL);
/* Return dlg_set to free nodes. */
pj_list_push_back(&mod_ua.free_dlgset_nodes, dlg_set);
+ } else {
+ /* If the just unregistered dialog is being used as hash key,
+ * reset the dlg_set entry with a new key (i.e: from the first dialog
+ * in dlg_set).
+ */
+ if (dlg_set->ht_key.ptr == dlg->local.info->tag.ptr &&
+ dlg_set->ht_key.slen == dlg->local.info->tag.slen)
+ {
+ pjsip_dialog* key_dlg = dlg_set->dlg_list.next;
+
+ /* Verify that the old & new keys share the hash value */
+ pj_assert(key_dlg->local.tag_hval == dlg->local.tag_hval);
+
+ pj_hash_set_lower(NULL, mod_ua.dlg_table, dlg_set->ht_key.ptr,
+ (unsigned)dlg_set->ht_key.slen,
+ dlg->local.tag_hval, NULL);
+
+ dlg_set->ht_key = key_dlg->local.info->tag;
+
+ pj_hash_set_np_lower(mod_ua.dlg_table,
+ dlg_set->ht_key.ptr,
+ (unsigned)dlg_set->ht_key.slen,
+ key_dlg->local.tag_hval, dlg_set->ht_entry,
+ dlg_set);
+ }
}
/* Unlock user agent. */

View file

@ -0,0 +1,37 @@
From 077b465c33f0aec05a49cd2ca456f9a1b112e896 Mon Sep 17 00:00:00 2001
From: sauwming <ming@teluu.com>
Date: Wed, 26 Jan 2022 13:28:57 +0800
Subject: [PATCH] Merge pull request from GHSA-7fw8-54cv-r7pm
---
pjlib-util/src/pjlib-util/scanner.c | 13 +++++++++----
1 file changed, 9 insertions(+), 4 deletions(-)
--- a/pjlib-util/src/pjlib-util/scanner.c
+++ b/pjlib-util/src/pjlib-util/scanner.c
@@ -444,16 +444,21 @@ PJ_DEF(void) pj_scan_get_n( pj_scanner *
PJ_DEF(int) pj_scan_get_char( pj_scanner *scanner )
{
- int chr = *scanner->curptr;
+ register char *s = scanner->curptr;
+ int chr;
- if (!chr) {
+ if (s >= scanner->end || !*s) {
pj_scan_syntax_err(scanner);
return 0;
}
- ++scanner->curptr;
+ chr = *s;
- if (PJ_SCAN_IS_PROBABLY_SPACE(*scanner->curptr) && scanner->skip_ws) {
+ ++s;
+ scanner->curptr = s;
+ if (PJ_SCAN_CHECK_EOF(s) && PJ_SCAN_IS_PROBABLY_SPACE(*s) &&
+ scanner->skip_ws)
+ {
pj_scan_skip_whitespace(scanner);
}
return chr;

View file

@ -9,12 +9,12 @@ include $(TOPDIR)/rules.mk
PKG_NAME:=sofia-sip
PKG_SOURCE_PROTO:=git
PKG_SOURCE_URL:=https://github.com/freeswitch/sofia-sip.git
PKG_SOURCE_DATE=2020-08-31
PKG_SOURCE_VERSION:=f6f29b483e9c31ce8d3e87419ec3deea8679312d
PKG_RELEASE:=1
PKG_MIRROR_HASH:=07b9b6198558542270699af2e31ff2331a49a5262e250cc78e3bf631dc444737
PKG_VERSION:=1.13.8
PKG_RELEASE:=$(AUTORELEASE)
PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.gz
PKG_SOURCE_URL:=https://codeload.github.com/freeswitch/$(PKG_NAME)/tar.gz/v${PKG_VERSION}?
PKG_HASH:=792b99eb35e50d7abeb42e91a5dceaf28afc5be1a85ffb01995855792a747fec
# sofia-sip adds a version to include path
# need to update this when the version changes

View file

@ -11,10 +11,10 @@ PKG_NAME:=spandsp3
PKG_SOURCE_PROTO:=git
PKG_SOURCE_URL:=https://github.com/freeswitch/spandsp.git
PKG_SOURCE_DATE=2020-08-14
PKG_SOURCE_VERSION:=6ec23e5a7e411a22d59e5678d12c4d2942c4a4b6
PKG_RELEASE:=2
PKG_MIRROR_HASH:=fcfa13576a25ff27e3746c3db30de89d2afceb963072b352a34e7a4a9f492ae5
PKG_SOURCE_DATE=2020-10-19
PKG_SOURCE_VERSION:=e08c74db3f072db893c4d37de733f03c27bf7ed3
PKG_RELEASE:=1
PKG_MIRROR_HASH:=4c2b29f71e130548a539cb86e47b34a5bda19896d96050868193e5aa86860db0
PKG_INSTALL:=1
PKG_BUILD_PARALLEL:=1

View file

@ -11,10 +11,10 @@ PKG_NAME:=asterisk-chan-dongle
PKG_SOURCE_PROTO:=git
PKG_SOURCE_URL:=https://github.com/wdoekes/asterisk-chan-dongle.git
PKG_SOURCE_VERSION:=328b2b7ded3b3c59c2e6c7e7afca6b0ac6f146ce
PKG_SOURCE_DATE=2020-05-28
PKG_SOURCE_VERSION:=3d046f7d6842298c6838b5ce5b51d495d383b158
PKG_SOURCE_DATE=2021-10-06
PKG_RELEASE:=1
PKG_MIRROR_HASH:=b0af444840340722ecee111a7b1f819de441acf290799ae11bc18e16569c6388
PKG_MIRROR_HASH:=d485c89a7230ab8c318eed6c3a954b154d7e53cc7a0194abf96f4dcb83e6909c
PKG_FIXUP:=autoreconf
@ -64,4 +64,19 @@ define Package/asterisk-chan-dongle/install
$(INSTALL_BIN) $(PKG_BUILD_DIR)/chan_dongle.so $(1)$(MODULES_DIR)
endef
define Package/asterisk-chan-dongle/postinst
#!/bin/sh
if [ -z "$${IPKG_INSTROOT}" ]; then
echo
echo "o-------------------------------------------------------------------o"
echo "| asterisk-chan-dongle note |"
echo "o-------------------------------------------------------------------o"
echo "| Adding the \"asterisk\" user to the \"dialout\" group might be |"
echo "| required for asterisk to be able to access the dongle. |"
echo "o-------------------------------------------------------------=^_^=-o"
echo
fi
exit 0
endef
$(eval $(call BuildPackage,asterisk-chan-dongle))

View file

@ -1,6 +1,6 @@
--- a/configure.ac
+++ b/configure.ac
@@ -83,7 +83,7 @@ fi
@@ -90,7 +90,7 @@ fi
dnl Checks for libraries.
dnl AC_CHECK_LIB([pthread], [pthread_create]) # should use ast_pthread_join everywhere?

View file

@ -1,8 +1,8 @@
--- a/configure.ac
+++ b/configure.ac
@@ -224,8 +224,6 @@ dnl Apply options to defines
@@ -237,8 +237,6 @@ dnl Apply options to defines
if test "x$enable_debug" = "xyes" ; then
CFLAGS="$CFLAGS -O0 -g"
CFLAGS="$CFLAGS -O0 -g3"
AC_DEFINE([__DEBUG__], [1], [Build with debugging])
-else
- CFLAGS="$CFLAGS -O6"

View file

@ -11,9 +11,9 @@ PKG_NAME:=asterisk-chan-lantiq
PKG_RELEASE:=1
PKG_SOURCE_URL:=https://github.com/kochstefan/asterisk_channel_lantiq.git
PKG_SOURCE_VERSION:=1d940b38cde0348dfe129d2b764e6faee440c45b
PKG_SOURCE_DATE:=2019-08-03
PKG_MIRROR_HASH:=f8aa4cccc90ad8503c94ddb03c4af7870f3262b99f1dca198c0e8d351aa96588
PKG_SOURCE_VERSION:=2f029ec8778420538c8151c6aceba0f7b44b07c9
PKG_SOURCE_DATE:=2021-09-11
PKG_MIRROR_HASH:=0c57aeb33dc7efb0078e77907e0bc616f1714251e64d647a59faffe5af8bac73
PKG_SOURCE_PROTO:=git
PKG_LICENSE:=GPL-2.0

View file

@ -8,12 +8,12 @@
include $(TOPDIR)/rules.mk
PKG_NAME:=asterisk
PKG_VERSION:=18.1.1
PKG_RELEASE:=3
PKG_VERSION:=18.11.2
PKG_RELEASE:=1
PKG_SOURCE:=asterisk-$(PKG_VERSION).tar.gz
PKG_SOURCE_URL:=https://downloads.asterisk.org/pub/telephony/asterisk/releases
PKG_HASH:=d0c0e90379c680a2803b9ba99d35918f5b9522c51998109bcc1937ee53ebdaa3
PKG_HASH:=b456d19610e53789446e097bb9773a82a04088922de0cfaff2b818326b67296b
PKG_BUILD_DEPENDS:=libxml2/host
@ -58,6 +58,7 @@ MODULES_AVAILABLE:= \
app-directed-pickup \
app-directory \
app-disa \
app-dtmfstore \
app-dumpchan \
app-exec \
app-externalivr \
@ -68,6 +69,7 @@ MODULES_AVAILABLE:= \
app-ices \
app-image \
app-ivrdemo \
app-mf \
app-milliwatt \
app-minivm \
app-mixmonitor \
@ -81,10 +83,12 @@ MODULES_AVAILABLE:= \
app-read \
app-readexten \
app-record \
app-reload \
app-saycounted \
app-sayunixtime \
app-senddtmf \
app-sendtext \
app-sf \
app-skel \
app-sms \
app-softhangup \
@ -100,6 +104,7 @@ MODULES_AVAILABLE:= \
app-url \
app-userevent \
app-verbose \
app-waitforcond \
app-voicemail \
app-voicemail-imap \
app-voicemail-odbc \
@ -180,6 +185,7 @@ MODULES_AVAILABLE:= \
func-enum \
func-env \
func-extstate \
func-frame-drop \
func-frame-trace \
func-global \
func-groupcount \
@ -187,6 +193,7 @@ MODULES_AVAILABLE:= \
func-holdintercept \
func-iconv \
func-jitterbuffer \
func-json \
func-lock \
func-math \
func-md5 \
@ -196,6 +203,8 @@ MODULES_AVAILABLE:= \
func-presencestate \
func-rand \
func-realtime \
func-sayfiles \
func-scramble \
func-sha1 \
func-shell \
func-sorcery \
@ -304,6 +313,7 @@ MODULES_AVAILABLE:= \
res-stun-monitor \
res-timing-dahdi \
res-timing-pthread \
res-tonedetect \
res-xmpp
UTILS_AVAILABLE:= \
@ -564,6 +574,7 @@ CONFIGURE_ARGS+= \
--without-pjproject-bundled \
--with-libedit="$(STAGING_DIR)/usr" \
--with-libxml2 \
--without-libxslt \
$(if $(CONFIG_PACKAGE_$(PKG_NAME)-res-snmp),--with-netsnmp="$(STAGING_DIR)/usr",--without-netsnmp) \
--without-newt \
--without-osptk \
@ -781,16 +792,18 @@ $(eval $(call BuildAsteriskModule,app-dictate,Virtual dictation machine,Virtual
$(eval $(call BuildAsteriskModule,app-directed-pickup,Directed call pickup,Directed call pickup application.,,,app_directed_pickup,,))
$(eval $(call BuildAsteriskModule,app-directory,Extension directory,Extension directory.,,,app_directory,,))
$(eval $(call BuildAsteriskModule,app-disa,Direct Inward System Access,Direct Inward System Access application.,,,app_disa,,))
$(eval $(call BuildAsteriskModule,app-dtmfstore,DTMF storage,Technology independent async DTMF storage.,,,app_dtmfstore,,))
$(eval $(call BuildAsteriskModule,app-dumpchan,Dump info about channel,Dump info about the calling channel.,,,app_dumpchan,,))
$(eval $(call BuildAsteriskModule,app-exec,Exec application,Executes dialplan applications.,,,app_exec,,))
$(eval $(call BuildAsteriskModule,app-externalivr,External IVR interface,External IVR interface application.,,,app_externalivr,,))
$(eval $(call BuildAsteriskModule,app-festival,Simple festival interface,Simple Festival interface.,,festival.conf,app_festival,,))
$(eval $(call BuildAsteriskModule,app-flash,Flash channel,Flash channel application.,+$(PKG_NAME)-chan-dahdi,,app_flash,,))
$(eval $(call BuildAsteriskModule,app-followme,Find-me/follow-me,Find-Me/Follow-Me application.,,followme.conf,app_followme,,))
$(eval $(call BuildAsteriskModule,app-getcpeid,Get ADSI CPE ID,Get ADSI CPE ID.,,,app_getcpeid,,))
$(eval $(call BuildAsteriskModule,app-getcpeid,Get ADSI CPE ID,Get ADSI CPE ID.,+asterisk-res-adsi,,app_getcpeid,,))
$(eval $(call BuildAsteriskModule,app-ices,Encode and stream,Encode and stream via Icecast and IceS.,,,app_ices,,))
$(eval $(call BuildAsteriskModule,app-image,Image transmission,Image transmission application.,,,app_image,,))
$(eval $(call BuildAsteriskModule,app-ivrdemo,IVR demo,IVR demo application.,,,app_ivrdemo,,))
$(eval $(call BuildAsteriskModule,app-mf,MF digits,Send MF digits Application.,,,app_mf,,))
$(eval $(call BuildAsteriskModule,app-milliwatt,Digital milliwatt [mu-law] test app,Digital milliwatt test application.,,,app_milliwatt,,))
$(eval $(call BuildAsteriskModule,app-minivm,Minimal voicemail system,A minimal voicemail e-mail system.,,extensions_minivm.conf minivm.conf,app_minivm,,))
$(eval $(call BuildAsteriskModule,app-mixmonitor,Record a call and mix the audio,Mixed audio monitoring application.,,,app_mixmonitor,,))
@ -804,10 +817,12 @@ $(eval $(call BuildAsteriskModule,app-queue,True Call Queueing,True call queuein
$(eval $(call BuildAsteriskModule,app-read,Variable read,Read variable application.,,,app_read,,))
$(eval $(call BuildAsteriskModule,app-readexten,Extension to variable,Read and evaluate extension validity.,,,app_readexten,,))
$(eval $(call BuildAsteriskModule,app-record,Record sound file,Trivial record application.,,,app_record,,))
$(eval $(call BuildAsteriskModule,app-reload,Reload,Reload module[s].,,,app_reload,,))
$(eval $(call BuildAsteriskModule,app-saycounted,Decline words,Decline words according to channel language.,,,app_saycounted,,))
$(eval $(call BuildAsteriskModule,app-sayunixtime,Say Unix time,Say time.,,,app_sayunixtime,,))
$(eval $(call BuildAsteriskModule,app-senddtmf,Send DTMF digits,Send DTMF digits application.,,,app_senddtmf,,))
$(eval $(call BuildAsteriskModule,app-sendtext,Send text,Send text applications.,,,app_sendtext,,))
$(eval $(call BuildAsteriskModule,app-sf,SF Sender and Receiver Applications,SF Sender and Receiver Applications.,,,app_sf,,))
$(eval $(call BuildAsteriskModule,app-skel,Skeleton [sample],Skeleton application.,,app_skel.conf,app_skel,,))
$(eval $(call BuildAsteriskModule,app-sms,SMS,SMS/PSTN handler.,,,app_sms,,))
$(eval $(call BuildAsteriskModule,app-softhangup,Hang up requested channel,Hangs up the requested channel.,,,app_softhangup,,))
@ -823,6 +838,7 @@ $(eval $(call BuildAsteriskModule,app-transfer,Transfers caller to other ext,Tra
$(eval $(call BuildAsteriskModule,app-url,Send URL,Send URL applications.,,,app_url,,))
$(eval $(call BuildAsteriskModule,app-userevent,Custom user event,Custom user event application.,,,app_userevent,,))
$(eval $(call BuildAsteriskModule,app-verbose,Verbose logging,Send verbose output.,,,app_verbose,,))
$(eval $(call BuildAsteriskModule,app-waitforcond,Wait for condition,Wait until condition is true.,,,app_waitforcond,,))
$(eval $(call BuildAsteriskModule,app-voicemail,Voicemail,Voicemail module.,,voicemail.conf,app_voicemail,vm-*,))
$(eval $(call BuildAsteriskModule,app-voicemail-imap,Voicemail IMAP,Voicemail module.,+uw-imap,,app_voicemail_imap,,))
$(eval $(call BuildAsteriskModule,app-voicemail-odbc,Voicemail ODBC,Voicemail module.,+unixodbc,,app_voicemail_odbc,,))
@ -903,6 +919,7 @@ $(eval $(call BuildAsteriskModule,func-dialplan,Dialplan context/extension/prior
$(eval $(call BuildAsteriskModule,func-enum,ENUM,ENUM related dialplan functions.,,enum.conf,func_enum,,))
$(eval $(call BuildAsteriskModule,func-env,Environment functions,Environment/filesystem dialplan functions.,,,func_env,,))
$(eval $(call BuildAsteriskModule,func-extstate,Hinted extension state,Gets the state of an extension in the dialplan.,,,func_extstate,,))
$(eval $(call BuildAsteriskModule,func-frame-drop,Frame drop,Function to drop frames on a channel.,,,func_frame_drop,,))
$(eval $(call BuildAsteriskModule,func-frame-trace,Frame trace for internal ast_frame debugging,Frame trace for internal ast_frame debugging.,,,func_frame_trace,,))
$(eval $(call BuildAsteriskModule,func-global,Global variable,Variable dialplan functions.,,,func_global,,))
$(eval $(call BuildAsteriskModule,func-groupcount,Group count,Channel group dialplan functions.,,,func_groupcount,,))
@ -910,6 +927,7 @@ $(eval $(call BuildAsteriskModule,func-hangupcause,HANGUPCAUSE related functions
$(eval $(call BuildAsteriskModule,func-holdintercept,Hold interception dialplan function,Hold interception dialplan function.,,,func_holdintercept,,))
$(eval $(call BuildAsteriskModule,func-iconv,Charset conversion,Charset conversions.,,,func_iconv,,,$(ICONV_DEPENDS)))
$(eval $(call BuildAsteriskModule,func-jitterbuffer,Jitter buffer for read side of channel,Jitter buffer for read side of channel.,,,func_jitterbuffer,,))
$(eval $(call BuildAsteriskModule,func-json,JSON decoding function,JSON decoding function.,,,func_json,,))
$(eval $(call BuildAsteriskModule,func-lock,Dialplan mutexes,Dialplan mutexes.,,,func_lock,,))
$(eval $(call BuildAsteriskModule,func-math,Math functions,Mathematical dialplan function.,,,func_math,,))
$(eval $(call BuildAsteriskModule,func-md5,MD5 digest dialplan functions,MD5 digest dialplan functions.,,,func_md5,,))
@ -919,6 +937,8 @@ $(eval $(call BuildAsteriskModule,func-pitchshift,Audio effects dialplan functio
$(eval $(call BuildAsteriskModule,func-presencestate,Hinted presence state,Gets or sets a presence state in the dialplan.,,,func_presencestate,,))
$(eval $(call BuildAsteriskModule,func-rand,RAND dialplan function,Random number dialplan function.,,,func_rand,,))
$(eval $(call BuildAsteriskModule,func-realtime,REALTIME dialplan function,Read/write/store/destroy values from a realtime repository.,,,func_realtime,,))
$(eval $(call BuildAsteriskModule,func-sayfiles,Say files,Say application files.,,,func_sayfiles,,))
$(eval $(call BuildAsteriskModule,func-scramble,Scramble,Frequency inverting voice scrambler.,,,func_scramble,,))
$(eval $(call BuildAsteriskModule,func-sha1,SHA-1 computation dialplan function,SHA-1 computation dialplan function.,,,func_sha1,,))
$(eval $(call BuildAsteriskModule,func-shell,Shell,Collects the output generated by a command executed by the system shell.,,,func_shell,,))
$(eval $(call BuildAsteriskModule,func-sorcery,Get a field from a sorcery object,Get a field from a sorcery object.,,,func_sorcery,,))
@ -1000,7 +1020,7 @@ $(eval $(call BuildAsteriskModule,res-parking,Phone Parking,Call parking resourc
$(eval $(call BuildAsteriskModule,res-phoneprov,Phone Provisioning,HTTP phone provisioning.,,phoneprov.conf,res_phoneprov,,))
$(eval $(call BuildAsteriskModule,res-pjsip-phoneprov,PJSIP Phone Provisioning,PJSIP phone provisioning.,+$(PKG_NAME)-pjsip +$(PKG_NAME)-res-phoneprov,,res_pjsip_phoneprov_provider,,))
$(eval $(call BuildAsteriskModule,res-pjsip-stir-shaken,PJSIP STIR/SHAKEN resource module,PJSIP STIR/SHAKEN resource module.,+$(PKG_NAME)-pjsip +$(PKG_NAME)-res-stir-shaken,,res_pjsip_stir_shaken,,))
$(eval $(call BuildAsteriskModule,res-pjproject,Bridge PJPROJECT to Asterisk logging,PJProject log and utility support.,+libpj +libpjlib-util +libpjmedia +libpjmedia +libpjnath +libpjsip-simple +libpjsip-ua +libpjsip +libpjsua +libpjsua2 +libsrtp2,pjproject.conf,res_pjproject,,))
$(eval $(call BuildAsteriskModule,res-pjproject,Bridge PJPROJECT to Asterisk logging,PJProject log and utility support.,+asterisk-res-sorcery +libpj +libpjlib-util +libpjmedia +libpjmedia +libpjnath +libpjsip-simple +libpjsip-ua +libpjsip +libpjsua +libpjsua2 +libsrtp2,pjproject.conf,res_pjproject,,))
$(eval $(call BuildAsteriskModule,res-pktccops,PktcCOPS manager for MGCP,PktcCOPS manager for MGCP.,,res_pktccops.conf,res_pktccops,,))
$(eval $(call BuildAsteriskModule,res-prometheus,Prometheus resource module,Prometheus resource module.,+libpjsip +libpjmedia +libpjnath +libpjsip-simple +libpjsip-ua +libpjsua +libpjsua2,prometheus.conf,res_prometheus,,))
$(eval $(call BuildAsteriskModule,res-realtime,RealTime CLI,Realtime data lookup/rewrite.,,,res_realtime,,))
@ -1027,6 +1047,7 @@ $(eval $(call BuildAsteriskModule,res-stir-shaken,STIR/SHAKEN resource module,ST
$(eval $(call BuildAsteriskModule,res-stun-monitor,STUN monitoring,STUN network monitor.,,res_stun_monitor.conf,res_stun_monitor,,))
$(eval $(call BuildAsteriskModule,res-timing-dahdi,DAHDI Timing Interface,DAHDI timing interface.,+$(PKG_NAME)-chan-dahdi,,res_timing_dahdi,,))
$(eval $(call BuildAsteriskModule,res-timing-pthread,pthread Timing Interface,pthread timing interface.,,,res_timing_pthread,,))
$(eval $(call BuildAsteriskModule,res-tonedetect,Tone detection,Tone detection module.,,,res_tonedetect,,))
$(eval $(call BuildAsteriskModule,res-xmpp,XMPP client and component module,Asterisk XMPP interface.,+libiksemel +libopenssl,xmpp.conf,res_xmpp,,))
################################

View file

@ -51,7 +51,6 @@ start_service() {
procd_open_instance
procd_set_param command $COMMAND
procd_append_param command \
-G "$NAME" \
-U "$NAME" \
$options \
-f

View file

@ -1,6 +1,6 @@
--- a/configure.ac
+++ b/configure.ac
@@ -1035,15 +1035,18 @@ AC_LINK_IFELSE(
@@ -1090,15 +1090,18 @@ AC_LINK_IFELSE(
# Some platforms define sem_init(), but only support sem_open(). joyous.
AC_MSG_CHECKING(for working unnamed semaphores)

View file

@ -18,7 +18,7 @@ Signed-off-by: Bernd Kuhls <bernd.kuhls@t-online.de>
--- a/configure.ac
+++ b/configure.ac
@@ -1429,7 +1429,11 @@ AC_LINK_IFELSE(
@@ -1484,7 +1484,11 @@ AC_LINK_IFELSE(
#include <arpa/nameser.h>
#endif
#include <resolv.h>],

View file

@ -15,14 +15,14 @@
cat << END
/*
* build.h
--- a/Makefile
+++ b/Makefile
@@ -488,7 +488,7 @@ doc/core-en_US.xml: makeopts .lastclean
@echo "<docs xmlns:xi=\"http://www.w3.org/2001/XInclude\">" >> $@
@for x in $(MOD_SUBDIRS); do \
printf "$$x " ; \
- for i in `find $$x -name '*.c'`; do \
+ for i in `find $$x -name '*.c' | LC_ALL=C sort`; do \
$(AWK) -f build_tools/get_documentation $$i >> $@ ; \
done ; \
done
--- a/build_tools/make_xml_documentation
+++ b/build_tools/make_xml_documentation
@@ -187,7 +187,7 @@ printf "Building Documentation For: "
for subdir in ${mod_subdirs} ; do
printf "%s " "${subdir}"
subdir_path="${source_tree}/${subdir}"
- for i in $(${FIND} "${subdir_path}" -name '*.c' -or -name '*.cc'); do
+ for i in $(${FIND} "${subdir_path}" -name '*.c' -or -name '*.cc' | LC_ALL=C sort); do
if [ "${with_moduleinfo}" -eq "1" ] ; then
MODULEINFO=$(${AWK} -f "${source_tree}/build_tools/get_moduleinfo" "${i}")
if [ "${MODULEINFO}" != "" ] ; then

View file

@ -1,6 +1,6 @@
--- a/configure.ac
+++ b/configure.ac
@@ -1208,7 +1208,7 @@ if test "${ac_cv_have_variable_fdset}x"
@@ -1263,7 +1263,7 @@ if test "${ac_cv_have_variable_fdset}x"
fi
AC_MSG_CHECKING([if we have usable eventfd support])

View file

@ -1,15 +1,11 @@
--- a/configure.ac
+++ b/configure.ac
@@ -2560,7 +2560,11 @@ if test -z "$__opus_include" -o x"$__opu
@@ -2619,7 +2619,7 @@ if test -z "$__opus_include" -o x"$__opu
fi
AST_EXT_LIB_CHECK([OPUSFILE], [opusfile], [op_open_callbacks], [opus/opusfile.h], [], [$__opus_include])
-for ver in 5.4 5.3 5.2 5.1; do
+# This does not work for us. We have both liblua and liblua5.3 in
+# $(STAGING_DIR)/usr. But the headers for liblua5.3 are in
+# (STAGING_DIR)/usr/include/lua5.3. Using the below, Asterisk would
+# use the headers from liblua and link against liblua5.3 :/
+for ver in ; do
-for ver in ${LUA_VERSIONS:-5.4 5.3 5.2 5.1}; do
+for ver in ${LUA_VERSIONS}; do
AST_EXT_LIB_CHECK([LUA], lua${ver}, [luaL_newstate], lua${ver}/lua.h, [-lm])
if test "x${PBX_LUA}" = "x1" ; then
if test x"${LUA_DIR}" = x; then

View file

@ -0,0 +1,22 @@
--- a/autoconf/ast_ext_tool_check.m4
+++ b/autoconf/ast_ext_tool_check.m4
@@ -8,13 +8,16 @@ AC_DEFUN([AST_EXT_TOOL_CHECK],
AC_REQUIRE([AST_PROG_SED])dnl
if test "x${PBX_$1}" != "x1" -a "${USE_$1}" != "no"; then
PBX_$1=0
- AC_PATH_TOOL(CONFIG_$1, $2, No, [${$1_DIR}/bin:$PATH])
+ if test "x${$1_DIR}" != "x"; then
+ AC_PATH_TOOL(CONFIG_$1, $2, No, [${$1_DIR}/bin:$PATH])
+ else
+ AC_PATH_TOOL(CONFIG_$1, $2, No, [$PATH])
+ fi
if test ! "x${CONFIG_$1}" = xNo; then
$1_INCLUDE=$(${CONFIG_$1} m4_default([$3],[--cflags]))
- $1_INCLUDE=$(echo ${$1_INCLUDE} | $SED -e "s|-I|-I${$1_DIR}|g" -e "s|-std=c99||g")
+ $1_INCLUDE=$(echo ${$1_INCLUDE} | $SED -e "s|-std=c99||g")
$1_LIB=$(${CONFIG_$1} m4_default([$4],[--libs]))
- $1_LIB=$(echo ${$1_LIB} | $SED -e "s|-L|-L${$1_DIR}|g")
m4_ifval([$5], [
saved_cppflags="${CPPFLAGS}"

View file

@ -0,0 +1,55 @@
From: https://issues.asterisk.org/jira/browse/ASTERISK-29905
From d27d75ad8058f6ed35197737b949bac57202dd54 Mon Sep 17 00:00:00 2001
From: "Sergey V. Lobanov" <sergey@lobanov.in>
Date: Wed, 9 Feb 2022 01:29:46 +0300
Subject: [PATCH] build: fix bininstall launchd issue on cross-platfrom build
configure script detects /sbin/launchd, but the result of this
check is not used in Makefile (bininstall). Makefile also detects
/sbin/launchd file to decide if it is required to install
safe_asterisk.
configure script correctly detects cross compile build and sets
PBX_LAUNCHD=0
In case of building asterisk on MacOS host for Linux target using
external toolchain (e.g. OpenWrt toolchain), bininstall does not
install safe_asterisk (due to /sbin/launchd detection in Makefile),
but it is required on target (Linux).
This patch adds HAVE_SBIN_LAUNCHD=@PBX_LAUNCHD@ to makeopts.in to
use the result of /sbin/launchd detection from configure script in
Makefile.
Also this patch uses HAVE_SBIN_LAUNCHD in Makefile (bininstall) to
decide if it is required to install safe_asterisk.
Signed-off-by: Sergey V. Lobanov <sergey@lobanov.in>
---
Makefile | 6 +++---
makeopts.in | 2 ++
2 files changed, 5 insertions(+), 3 deletions(-)
--- a/Makefile
+++ b/Makefile
@@ -558,9 +558,9 @@ bininstall: _all installdirs $(SUBDIRS_I
$(INSTALL) -m 755 contrib/scripts/astversion "$(DESTDIR)$(ASTSBINDIR)/"
$(INSTALL) -m 755 contrib/scripts/astgenkey "$(DESTDIR)$(ASTSBINDIR)/"
$(INSTALL) -m 755 contrib/scripts/autosupport "$(DESTDIR)$(ASTSBINDIR)/"
- if [ ! -f /sbin/launchd ]; then \
- ./build_tools/install_subst contrib/scripts/safe_asterisk "$(DESTDIR)$(ASTSBINDIR)/safe_asterisk"; \
- fi
+ifneq ($(HAVE_SBIN_LAUNCHD),1)
+ ./build_tools/install_subst contrib/scripts/safe_asterisk "$(DESTDIR)$(ASTSBINDIR)/safe_asterisk";
+endif
ifneq ($(DISABLE_XMLDOC),yes)
$(INSTALL) -m 644 doc/core-*.xml "$(DESTDIR)$(ASTDATADIR)/documentation"
--- a/makeopts.in
+++ b/makeopts.in
@@ -373,3 +373,5 @@ SNDFILE_LIB=@SNDFILE_LIB@
BEANSTALK_INCLUDE=@BEANSTALK_INCLUDE@
BEANSTALK_LIB=@BEANSTALK_LIB@
+
+HAVE_SBIN_LAUNCHD=@PBX_LAUNCHD@

View file

@ -8,13 +8,13 @@
include $(TOPDIR)/rules.mk
PKG_NAME:=freeswitch
PKG_VERSION:=1.10.5
PKG_RELEASE:=4
PKG_VERSION:=1.10.7
PKG_RELEASE:=1
PKG_MAINTAINER:=Sebastian Kemper <sebastian_ml@gmx.net>
PKG_SOURCE:=freeswitch-$(PKG_VERSION).-release.tar.xz
PKG_SOURCE_URL:=https://files.freeswitch.org/releases/freeswitch
PKG_HASH:=3e26600767a82946eca94af2c8f14712783aa83db5fb1cc57585f544aecce327
PKG_HASH:=0919bddc2ea9cab2e4944314e71637bea9dd4f40d510722a74ea032104594c41
PKG_CPE_ID:=cpe:/a:freeswitch:freeswitch
@ -115,7 +115,6 @@ FS_MOD_AVAILABLE:= \
fail2ban \
fifo \
format_cdr \
freetdm \
fsk \
fsv \
g723_1 \
@ -152,6 +151,7 @@ FS_MOD_AVAILABLE:= \
portaudio_stream \
posix_timer \
prefix \
python3 \
radius_cdr \
random \
raven \
@ -218,16 +218,15 @@ PKG_CONFIG_DEPENDS:= \
CONFIG_FS_WITH_DEBUG \
CONFIG_FS_WITH_FREETYPE \
CONFIG_FS_WITH_LIBYUV \
CONFIG_FS_WITH_MODCONF \
CONFIG_FS_WITH_ODBC \
CONFIG_FS_WITH_PNG \
CONFIG_FS_WITH_SRTP \
CONFIG_FS_WITH_VPX \
CONFIG_FS_WITH_ZRTP \
CONFIG_LIBC \
CONFIG_PACKAGE_libfreetdm \
CONFIG_PACKAGE_libfreetdm-ftmod-libpri \
CONFIG_PACKAGE_libfreetdm-ftmod-pritap \
CONFIG_PACKAGE_freeswitch-misc-perl-esl \
CONFIG_PACKAGE_freeswitch-misc-python3-esl \
CONFIG_SOFT_FLOAT
include $(INCLUDE_DIR)/uclibc++.mk
@ -248,6 +247,7 @@ endif
FS_PERL_FEED:=$(TOPDIR)/feeds/packages/lang/perl
include $(TOPDIR)/feeds/packages/lang/python/python3-version.mk
include $(FS_PERL_FEED)/perlver.mk
PERL_SITELIB:=/usr/lib/perl$(PERL_MAJOR)/$(PERL_VERSION2)
@ -256,6 +256,8 @@ FS_PERL_LIBS:=$(shell grep "^libs=" \
$(FS_PERL_FEED)/files/base.config | \
sed "s/^libs=//;s/'//g")
FS_PYTHON3_SITE_DIR:=$(FS_LIB_DIR)/python$(PYTHON3_VERSION)/site-packages
define Download/files
define Download/$(1)
FILE:=$(2)
@ -291,12 +293,6 @@ define Package/freeswitch/install/dir
done
endef
define Package/libfreetdm/install/ftmod
$(INSTALL_DIR) $(1)$(FS_MOD_DIR)
$(INSTALL_BIN) $(PKG_INSTALL_DIR)$(FS_MOD_DIR)/ftmod_$(2).so \
$(1)$(FS_MOD_DIR)
endef
define Package/freeswitch/install/lib
$(INSTALL_DIR) $(1)$(FS_LIB_DIR)
$(CP) $(PKG_INSTALL_DIR)$(FS_LIB_DIR)/$(2).so.* \
@ -313,45 +309,6 @@ define Package/freeswitch/config
source "$(SOURCE)/Config.in"
endef
define Package/libfreetdm/Default
SECTION:=libs
CATEGORY:=Libraries
SUBMENU:=Telephony
URL:=https://www.freeswitch.org
endef
define Package/libfreetdm
$(call Package/libfreetdm/Default)
DEPENDS:=
TITLE:=TDM signaling and media API
MENU:=1
URL:=https://www.freeswitch.org
endef
define Package/libfreetdm/description
Provides a unified interface to hardware TDM cards and SS7 stacks.
endef
define Package/libfreetdm/install
$(call Package/freeswitch/install/lib,$(1),libfreetdm)
endef
define Package/libfreetdm/FTModule
define Package/libfreetdm-ftmod-$(subst _,-,$(1))
$(call Package/libfreetdm/Default)
DEPENDS:=libfreetdm \
$(patsubst +%,+PACKAGE_libfreetdm-ftmod-$(subst _,-,$(1)):%,$(4))
TITLE:=$(2) FreeTDM module
endef
define Package/libfreetdm-ftmod-$(subst _,-,$(1))/description
$(subst \n,$(newline),$(3))
endef
define Package/libfreetdm-ftmod-$(subst _,-,$(1))/install
$(call Package/libfreetdm/install/ftmod,$$(1),$(1))
endef
$$(eval $$(call BuildPackage,libfreetdm-ftmod-$(subst _,-,$(1))))
endef
define Package/freeswitch/Default
SUBMENU:=Telephony
SECTION:=net
@ -473,6 +430,27 @@ define Package/freeswitch-misc-perl-esl/install
$(1)$(PERL_SITELIB)/ESL
endef
define Package/freeswitch-misc-python3-esl
$(call Package/freeswitch/Default)
TITLE:=Python3 ESL
DEPENDS:=freeswitch +PACKAGE_freeswitch-misc-python3-esl:python3-light
endef
define Package/freeswitch-misc-python3-esl/description
This package contains the Python3 binding for FreeSWITCH's Event Socket
Library (ESL).
endef
define Package/freeswitch-misc-python3-esl/install
$(INSTALL_DIR) $(1)$(FS_PYTHON3_SITE_DIR)
$(INSTALL_BIN) \
$(PKG_INSTALL_DIR)$(FS_PYTHON3_SITE_DIR)/_ESL.so \
$(1)$(FS_PYTHON3_SITE_DIR)
$(INSTALL_DATA) \
$(PKG_INSTALL_DIR)$(FS_PYTHON3_SITE_DIR)/ESL.py \
$(1)$(FS_PYTHON3_SITE_DIR)
endef
define Package/freeswitch-misc-timezones
$(call Package/freeswitch/Default)
TITLE:=Timezones file
@ -570,6 +548,12 @@ ifeq ($(1),perl)
$(PKG_INSTALL_DIR)/usr/perl/freeswitch.pm \
$$(1)$(PERL_SITELIB)
endif
ifeq ($(1),python3)
$(INSTALL_DIR) $$(1)$(FS_PYTHON3_SITE_DIR)
$(INSTALL_DATA) \
$(PKG_INSTALL_DIR)$(FS_PYTHON3_SITE_DIR)/freeswitch.py \
$$(1)$(FS_PYTHON3_SITE_DIR)
endif
endef
$$(eval $$(call BuildPackage,freeswitch-mod-$(subst _,-,$(1))))
endef
@ -615,9 +599,15 @@ CONFIGURE_ARGS+= \
$(if $(CONFIG_FS_WITH_FREETYPE),,--without-freetype) \
$(if $(CONFIG_FS_WITH_ODBC),--with-odbc-lib="$(STAGING_DIR)$(FS_LIB_DIR)") \
$(if $(CONFIG_FS_WITH_ODBC),--with-odbc="$(STAGING_DIR)/usr") \
$(if $(CONFIG_FS_WITH_PNG),,--without-png) \
$(if $(CONFIG_PACKAGE_libfreetdm-ftmod-libpri),--with-libpri="$(STAGING_DIR)/usr",--without-libpri) \
$(if $(CONFIG_PACKAGE_libfreetdm-ftmod-pritap),--with-pritap,--without-pritap)
$(if $(CONFIG_FS_WITH_PNG),,--without-png)
ifneq ($(CONFIG_PACKAGE_freeswitch-misc-python3-esl)$(CONFIG_PACKAGE_freeswitch-mod-python3),)
CONFIGURE_ARGS+= \
--with-python3=$(STAGING_DIR_HOST)/bin/python3
else
CONFIGURE_ARGS+= \
--with-python3=no
endif
ifeq ($(CONFIG_PACKAGE_freeswitch-mod-erlang-event)$(CONFIG_PACKAGE_freeswitch-mod-kazoo),)
CONFIGURE_ARGS+= \
@ -690,6 +680,15 @@ CONFIGURE_VARS+= \
ac_cv_prog_PERL=false
endif
ifneq ($(CONFIG_PACKAGE_freeswitch-misc-python3-esl)$(CONFIG_PACKAGE_freeswitch-mod-python3),)
CONFIGURE_VARS+= \
PYTHON3_CFLAGS="-I$(STAGING_DIR)/usr/include/python$(PYTHON3_VERSION)" \
PYTHON3_LDFLAGS="-lpython$(PYTHON3_VERSION)" \
PYTHON3_LIB="python$(PYTHON3_VERSION)" \
PYTHON3_LIBDIR="$(FS_LIB_DIR)" \
PYTHON3_SITE_DIR="$(FS_PYTHON3_SITE_DIR)"
endif
# mod_radius_cdr runs configure in libs/freeradius-client. Let
# freeradius-client know /dev/urandom is available on target devices.
MAKE_VARS+= \
@ -811,61 +810,41 @@ ifneq ($(CONFIG_PACKAGE_freeswitch-mod-radius-cdr),)
$(CP) $(DL_DIR)/$(FS_FREERADIUS_CLIENT_FILE) $(PKG_BUILD_DIR)/libs
endif
# Compile FreeTDM first
ifneq ($(CONFIG_PACKAGE_libfreetdm),)
$(call Build/Compile/Default,-C $(PKG_BUILD_DIR)/libs/freetdm)
endif
ifneq ($(CONFIG_PACKAGE_freeswitch),)
$(call Build/Compile/Default)
endif
ifneq ($(CONFIG_PACKAGE_freeswitch-misc-perl-esl),)
$(call Build/Compile/Default,-C $(PKG_BUILD_DIR)/libs/esl perlmod)
endif
ifneq ($(CONFIG_PACKAGE_freeswitch-misc-python3-esl),)
$(call Build/Compile/Default,-C $(PKG_BUILD_DIR)/libs/esl py3mod)
endif
endef
define Build/Install
# Again, FreeTDM first
ifneq ($(CONFIG_PACKAGE_libfreetdm),)
$(call Build/Install/Default,-C $(PKG_BUILD_DIR)/libs/freetdm install)
endif
ifneq ($(CONFIG_PACKAGE_freeswitch),)
$(call Build/Install/Default)
endif
ifneq ($(CONFIG_PACKAGE_freeswitch-misc-perl-esl),)
$(call Build/Compile/Default,-C $(PKG_BUILD_DIR)/libs/esl DESTDIR=$(PKG_INSTALL_DIR) perlmod-install)
endif
ifneq ($(CONFIG_PACKAGE_freeswitch-misc-python3-esl),)
$(call Build/Install/Default,-C $(PKG_BUILD_DIR)/libs/esl py3mod-install)
endif
endef
define Build/InstallDev/libfreetdm
$(INSTALL_DIR) $(1)/usr/include
$(INSTALL_DATA) \
$(PKG_INSTALL_DIR)$(FS_PKGCONFIG_DIR)/freetdm.pc \
define Build/InstallDev
$(INSTALL_DIR) $(1)$(FS_INCLUDES_DIR) $(1)$(FS_LIB_DIR) \
$(1)$(FS_PKGCONFIG_DIR)
$(INSTALL_DATA) $(PKG_INSTALL_DIR)/usr/include/*.h $(1)/usr/include
endef
define Build/InstallDev/freeswitch
$(INSTALL_DIR) $(1)$(FS_INCLUDES_DIR)
$(INSTALL_DATA) $(PKG_INSTALL_DIR)$(FS_INCLUDES_DIR)/*.h \
$(1)$(FS_INCLUDES_DIR)
$(INSTALL_DATA) \
$(PKG_INSTALL_DIR)$(FS_PKGCONFIG_DIR)/freeswitch.pc \
$(1)$(FS_PKGCONFIG_DIR)
$(CP) $(PKG_INSTALL_DIR)$(FS_LIB_DIR)/libfreeswitch.so* \
$(1)$(FS_LIB_DIR)
endef
define Build/InstallDev
$(INSTALL_DIR) $(1)$(FS_PKGCONFIG_DIR)
ifneq ($(CONFIG_PACKAGE_libfreetdm),)
$(call Build/InstallDev/libfreetdm,$(1))
endif
ifneq ($(CONFIG_PACKAGE_freeswitch),)
$(call Build/InstallDev/freeswitch,$(1))
endif
endef
$(eval $(call BuildPackage,libfreetdm))
$(eval $(call BuildPackage,freeswitch))
$(eval $(call BuildPackage,freeswitch-misc-perl-esl))
$(eval $(call BuildPackage,freeswitch-misc-python3-esl))
$(eval $(call BuildPackage,freeswitch-misc-timezones))
################################
@ -883,22 +862,6 @@ $(eval $(call Package/freeswitch/Example,softphone))
$(eval $(call Package/freeswitch/Example,testing))
$(eval $(call Package/freeswitch/Example,vanilla))
################################
# FreeTDM modules
# Params:
# 1 - Package subname
# 2 - Package title
# 3 - Module description
# 4 - Module dependencies
################################
$(eval $(call Package/libfreetdm/FTModule,analog,Analog,Offers generic FXO/FXS support for any type of card supported by FreeTDM.,))
$(eval $(call Package/libfreetdm/FTModule,analog_em,Analog EM,Offers generic E&M signaling for any type of card supported by FreeTDM.,))
$(eval $(call Package/libfreetdm/FTModule,libpri,LibPRI,Offers support for PRI lines using the open source libpri stack for any\ntype of card supported by FreeTDM. Supports both PRI and BRI signalling.,+libpri @!aarch64))
$(eval $(call Package/libfreetdm/FTModule,pritap,PRI tapping,This module is used to tap PRI lines.,+libfreetdm-ftmod-libpri))
$(eval $(call Package/libfreetdm/FTModule,skel,Skeleton,ftmod_skel is an example module.,))
$(eval $(call Package/libfreetdm/FTModule,zt,DAHDI I/O,This module supports the DAHDI interface. The DAHDI interface is used by\nseveral hardware vendors.,))
################################
# FreeSWITCH language files
# Params:
@ -984,7 +947,6 @@ $(eval $(call Package/freeswitch/Module,expr,Expr,This module adds expr support
$(eval $(call Package/freeswitch/Module,fail2ban,Fail2ban logging,Provides support for Fail2ban logging.,))
$(eval $(call Package/freeswitch/Module,fifo,FIFO,This module adds a first-in first-out queue system.,))
$(eval $(call Package/freeswitch/Module,format_cdr,Multiformat CDR,A superset of mod_json_cdr and mod_xml_cdr.,))
$(eval $(call Package/freeswitch/Module,freetdm,FreeTDM endpoint,This module is the glue between FreeSWITCH and FreeTDM.,+libfreetdm))
$(eval $(call Package/freeswitch/Module,fsk,FSK,This module adds frequency-shift keying support which can be used to\nsend and receive caller ID.,))
$(eval $(call Package/freeswitch/Module,fsv,FSV,This module provides dialplan applications for recording and playing\nvideos.,))
$(eval $(call Package/freeswitch/Module,g723_1,G.723.1 passthrough,G.723.1 codec passthrough.,))
@ -1021,6 +983,7 @@ $(eval $(call Package/freeswitch/Module,portaudio,Portaudio,Voice through a loca
$(eval $(call Package/freeswitch/Module,portaudio_stream,Portaudio streaming,Stream from an external audio source for Music on Hold.,+portaudio))
$(eval $(call Package/freeswitch/Module,posix_timer,POSIX timer,Add POSIX timer support.,))
$(eval $(call Package/freeswitch/Module,prefix,Prefix match,This module provides a data store with fast lookups by the longest\nprefix match rule.,))
$(eval $(call Package/freeswitch/Module,python3,Python3,Python3 support module.,+python3-light))
$(eval $(call Package/freeswitch/Module,radius_cdr,Radius CDR,Radius Call Detail Record handler.,))
$(eval $(call Package/freeswitch/Module,random,Entropy,This module extracts entropy from FreeSWITCH and feeds it into\n/dev/random.,))
$(eval $(call Package/freeswitch/Module,raven,Raven logging,Adds support for logging to Raven instances.,))
@ -1069,7 +1032,7 @@ $(eval $(call Package/freeswitch/Module,translate,Number translation,This module
$(eval $(call Package/freeswitch/Module,tts_commandline,TTS command-line,Run a command-line and play the output file.,))
$(eval $(call Package/freeswitch/Module,unimrcp,UniMRCP,Allows communication with Media Resource Control Protocol servers.,))
$(eval $(call Package/freeswitch/Module,valet_parking,Valet parking,This module implements the valet call parking strategy.,))
$(eval $(call Package/freeswitch/Module,verto,Verto,Verto signaling protocol.,))
$(eval $(call Package/freeswitch/Module,verto,Verto,Verto signaling protocol.,+libks))
$(eval $(call Package/freeswitch/Module,video_filter,Video filter chromakey,This module provides a media bug for chromakey functionality.,))
$(eval $(call Package/freeswitch/Module,vmd,Voicemail detection,This module detects voicemail beeps.,))
$(eval $(call Package/freeswitch/Module,voicemail,Voicemail,This module provides a voicemail system.,))

View file

@ -4,6 +4,7 @@ config freeswitch 'general'
option log_stderr '1'
option log_stdout '1'
option options '-nonat -np'
#option term_timeout '10' # seconds to wait after sending TERM signal
config freeswitch 'directories'
option cache '/tmp/freeswitch/cache'

View file

@ -4,8 +4,9 @@ NAME=freeswitch
COMMAND=/etc/init.d/$NAME
LOGGER="/usr/bin/logger -t $NAME-hotplug"
LOG_ERR="$LOGGER -p user.err --"
LOG_NOTICE="$LOGGER -p user.notice --"
LOG_ERR="$LOGGER -p daemon.err --"
LOG_INFO="$LOGGER -p daemon.info --"
LOG_WARN="$LOGGER -p daemon.warn --"
[ "$ACTION" = ifup ] || exit 0
@ -18,7 +19,7 @@ config_get interface hotplug interface
pidof $NAME &> /dev/null
if [ $? -eq 0 ]; then
$LOG_NOTICE stopping $NAME
$LOG_INFO stopping $NAME
$COMMAND stop &> /dev/null
fi
@ -43,7 +44,7 @@ config_get mount_point hotplug mount_point
while [ -n "$notReady" -a $tmp_timeout -gt 0 ]; do
if [ "$notReady" != start ]; then
$LOG_NOTICE "$mnt" not yet mounted, timeout in $tmp_timeout s
$LOG_INFO "$mnt" not yet mounted, timeout in $tmp_timeout s
sleep 5
tmp_timeout=$(($tmp_timeout-5))
fi
@ -61,7 +62,7 @@ config_get mount_point hotplug mount_point
$LOG_ERR not starting $NAME
exit 1
else
$LOG_NOTICE "$mnt" mounted
$LOG_INFO "$mnt" mounted
fi
}
@ -87,7 +88,7 @@ config_get_bool ntpd hotplug ntpd 0
while [ -n "$notReady" -a $tmp_timeout -gt 0 ]; do
if [ "$notReady" != start ]; then
$LOG_NOTICE system time not in sync yet, timeout in $tmp_timeout s
$LOG_INFO system time not in sync yet, timeout in $tmp_timeout s
sleep 5
tmp_timeout=$(($tmp_timeout-5))
fi
@ -97,20 +98,20 @@ config_get_bool ntpd hotplug ntpd 0
result=$(ntpq -c 'timeout 300' -c 'rv 0 stratum' 2> /dev/null | \
awk -F '=' '{print $2}' | grep -o -E '^[0-9]+')
if [ -z $result ]; then
$LOG_ERR failed to extract stratum from ntpd
$LOG_WARN failed to extract stratum from ntpd
notReady="unable to extract stratum"
else
$LOG_NOTICE ntpd stratum $result
$LOG_INFO ntpd stratum $result
if [ $result -lt 16 ] 2> /dev/null; then
result=$(ntpq -c 'timeout 300' -c 'rv 0 offset' 2> /dev/null \
| awk -F '=' '{print $2}' | grep -o -E '^-?[0-9]+')
| awk -F '=' '{print $2}' | grep -o -E '^[-+]?[0-9]+')
if [ -z $result ]; then
$LOG_ERR failed to extract offset from ntpd
$LOG_WARN failed to extract offset from ntpd
notReady="unable to extract offset"
else
# "-0" looks stupid, so remove "-"
result=$(echo $result | grep -o '[0-9]*')
$LOG_NOTICE ntpd to system time offset \+\/\- $result ms
$LOG_INFO ntpd to system time offset \+\/\- $result ms
# If offset < 100 ms consider system time in sync
[ $result -lt 100 ] || notReady="system time not in sync yet"
fi
@ -125,7 +126,7 @@ config_get_bool ntpd hotplug ntpd 0
$LOG_ERR not starting $NAME
exit 1
else
$LOG_NOTICE system time in sync
$LOG_INFO system time in sync
fi
}
@ -134,7 +135,7 @@ $COMMAND start &> /dev/null
sleep 1
pidof $NAME &>/dev/null
if [ $? -eq 0 ]; then
$LOG_NOTICE started $NAME due to \"ifup "$INTERFACE"\" event
$LOG_INFO started $NAME due to \"ifup "$INTERFACE"\" event
else
$LOG_ERR start of $NAME due to \"ifup "$INTERFACE"\" event failed
exit 1

View file

@ -10,7 +10,10 @@ USE_PROCD=1
NAME=freeswitch
COMMAND=/usr/bin/$NAME
LOGGER="/usr/bin/logger -p user.err -s -t $NAME --"
LOGGER="/usr/bin/logger -s -t $NAME"
LOG_ERR="$LOGGER -p daemon.err --"
LOG_WARN="$LOGGER -p daemon.warn --"
LOG_INFO="$LOGGER -p daemon.info --"
start_service() {
dir_etc=/etc/$NAME
@ -21,7 +24,7 @@ start_service() {
config_get_bool enabled general enabled 0
if [ $enabled -eq 0 ]; then
$LOGGER service not enabled in /etc/config/$NAME
$LOG_ERR service not enabled in /etc/config/$NAME
exit 1
fi
@ -37,6 +40,14 @@ start_service() {
config_get options general options
config_get term_timeout general term_timeout default
if [ default = "$term_timeout" ]; then
$LOG_INFO using procd\'s default term_timeout
elif ! [ 0 -lt "$term_timeout" ] 2>/dev/null; then
$LOG_ERR invalid term_timeout in /etc/config/$NAME
exit 1
fi
for i in "$dir_localstate" "$dir_run"; do
if ! [ -e "$i" ]; then
mkdir -m 0750 -p "$i"
@ -47,8 +58,8 @@ start_service() {
command -v su >/dev/null
ret=$?
if [ 0 != "$ret" ]; then
$LOGGER utility \"su\" not available
$LOGGER will not attempt to create directories
$LOG_WARN utility \"su\" not available
$LOG_WARN will not attempt to create directories
else
for i in "$dir_cache" \
"$dir_db" \
@ -84,5 +95,8 @@ start_service() {
procd_set_param stderr $log_stderr
# same for stdout
procd_set_param stdout $log_stdout
if ! [ default = "$term_timeout" ]; then
procd_set_param term_timeout "$term_timeout"
fi
procd_close_instance
}

View file

@ -1,8 +1,10 @@
--- a/build/modmake.rulesam
+++ b/build/modmake.rulesam
@@ -2,7 +2,7 @@ AUTOMAKE_OPTIONS = foreign subdir-object
@@ -1,8 +1,8 @@
AUTOMAKE_OPTIONS = foreign subdir-objects
AM_CFLAGS = $(SWITCH_AM_CFLAGS) $(SWITCH_ANSI_CFLAGS)
AM_CPPFLAGS = $(SWITCH_AM_CXXFLAGS)
-AM_CPPFLAGS = $(SWITCH_AM_CXXFLAGS)
+AM_CPPFLAGS = $(SWITCH_AM_CPPFLAGS)
AM_LDFLAGS = $(SWITCH_AM_LDFLAGS)
-DEFAULT_VARS = CFLAGS="$(CFLAGS)" CPPFLAGS="$(CXXFLAGS)" LDFLAGS="$(LDFLAGS)" CC="$(CC)" CXX="$(CXX)"
+DEFAULT_VARS = CFLAGS="$(CFLAGS)" CPPFLAGS="$(CPPFLAGS)" CXXFLAGS="$(CXXFLAGS)" LDFLAGS="$(LDFLAGS)" CC="$(CC)" CXX="$(CXX)"

View file

@ -40,7 +40,7 @@
AC_PATH_PROG([PKG_CONFIG], [pkg-config], [no])
case $host in
@@ -1637,13 +1613,7 @@ AC_CHECK_PROG(PERL,perl,[ac_cv_have_perl
@@ -1660,13 +1636,7 @@ AC_CHECK_PROG(PERL,perl,[ac_cv_have_perl
# -a "x$ac_cv_have_EXTERN_h" != "xno"
if test "x$ac_cv_have_perl" != "xno"; then

View file

@ -1,49 +0,0 @@
commit 70d1cbafe4ab0176cd9fc01f740e34cd1bae326b
Author: Sebastian Kemper <sebastian_ml@gmx.net>
Date: Wed Nov 13 20:29:50 2019 +0100
[gentls_cert] Update message digest
Debian Buster updated /etc/ssl/openssl.cnf to default to
MinProtocol = TLSv1.2
CipherString = DEFAULT@SECLEVEL=2
gentls_cert currently uses SHA1 as message digest. According to OpenSSL
documentation this only offers 80 bit of security. 80 bits is enough for
security level 1, but not 2.
The OpenSSL default MD nowadays is SHA256. This commit updates
gentls_cert to use it.
Issue was reported on the FS mailing list. The certificates created by
gentls_cert caused "md too weak" errors and clients were unable to
connect.
Signed-off-by: Sebastian Kemper <sebastian_ml@gmx.net>
--- a/scripts/gentls_cert.in
+++ b/scripts/gentls_cert.in
@@ -89,7 +89,7 @@ setup_ca() {
openssl req -out "${CONFDIR}/CA/cacert.pem" \
-new -x509 -keyout "${CONFDIR}/CA/cakey.pem" \
- -config "${TMPFILE}.cfg" -nodes -days ${DAYS} -sha1 >/dev/null || exit 1
+ -config "${TMPFILE}.cfg" -nodes -days ${DAYS} -sha256 >/dev/null || exit 1
cat "${CONFDIR}/CA/cacert.pem" > "${CONFDIR}/cafile.pem"
cp $TMPFILE.cfg /tmp/ssl.cfg
rm "${TMPFILE}.cfg"
@@ -131,11 +131,11 @@ generate_cert() {
openssl req -new -out "${TMPFILE}.req" \
-newkey rsa:${KEY_SIZE} -keyout "${TMPFILE}.key" \
- -config "${TMPFILE}.cfg" -nodes -sha1 >/dev/null || exit 1
+ -config "${TMPFILE}.cfg" -nodes -sha256 >/dev/null || exit 1
openssl x509 -req -CAkey "${CONFDIR}/CA/cakey.pem" -CA "${CONFDIR}/CA/cacert.pem" -CAcreateserial \
-in "${TMPFILE}.req" -out "${TMPFILE}.crt" -extfile "${TMPFILE}.cfg" \
- -extensions "${EXTENSIONS}" -days ${DAYS} -sha1 >/dev/null || exit 1
+ -extensions "${EXTENSIONS}" -days ${DAYS} -sha256 >/dev/null || exit 1
cat "${TMPFILE}.crt" "${TMPFILE}.key" > "${CONFDIR}/${OUTFILE}"

View file

@ -12,7 +12,7 @@
#include <errno.h>
#include <string.h>
#include <stdio.h>
@@ -531,14 +532,10 @@ int main(void)
@@ -534,14 +535,10 @@ int main(void)
}], [
ac_cv_strerror_r_rc_int=yes ], [
ac_cv_strerror_r_rc_int=no ], [
@ -42,7 +42,7 @@
#include <errno.h>
#include <string.h>
#include <stdio.h>
@@ -531,14 +532,10 @@ int main(void)
@@ -534,14 +535,10 @@ int main(void)
}], [
ac_cv_strerror_r_rc_int=yes ], [
ac_cv_strerror_r_rc_int=no ], [

View file

@ -1,6 +1,6 @@
--- a/configure.ac
+++ b/configure.ac
@@ -2069,7 +2069,12 @@ AC_SUBST(OUR_DISABLED_INSTALL_MODS)
@@ -2263,7 +2263,12 @@ AC_SUBST(OUR_DISABLED_INSTALL_MODS)
AC_SUBST(OUR_DISABLED_UNINSTALL_MODS)
AC_SUBST(AM_MAKEFLAGS)
@ -84,7 +84,7 @@
AC_LANG_C
--- a/libs/srtp/configure.ac
+++ b/libs/srtp/configure.ac
@@ -3,9 +3,12 @@ AC_INIT(srtp, 1.4.2, mcgrew@cisco.com)
@@ -3,9 +3,12 @@ AC_INIT(srtp, 2.4.0, mcgrew@cisco.com)
AC_CONFIG_AUX_DIR(build)
AM_INIT_AUTOMAKE

View file

@ -1,6 +1,6 @@
--- a/Makefile.am
+++ b/Makefile.am
@@ -583,8 +583,15 @@ libs/libedit/src/.libs/libedit.a:
@@ -585,8 +585,15 @@ libs/libedit/src/.libs/libedit.a:
libs/libzrtp/libzrtp.a:
cd libs/libzrtp && $(MAKE)

View file

@ -5,7 +5,7 @@
$(RADCLIENT_BUILDDIR)/Makefile: $(RADCLIENT_DIR)
mkdir -p $(RADCLIENT_BUILDDIR)
- cd $(RADCLIENT_BUILDDIR) && $(DEFAULT_VARS) $(RADCLIENT_DIR)/configure $(DEFAULT_ARGS) --srcdir=$(RADCLIENT_DIR)
+ cd $(RADCLIENT_BUILDDIR) && patch -p1 < ../../src/mod/event_handlers/mod_radius_cdr/freeradius-client-1.1.6-configure-in.diff && autoreconf -v -f -i -s && $(DEFAULT_VARS) CFLAGS+="-Wno-cpp" $(RADCLIENT_DIR)/configure $(DEFAULT_ARGS) --srcdir=$(RADCLIENT_DIR)
+ cd $(RADCLIENT_BUILDDIR) && patch -N -p1 < ../../src/mod/event_handlers/mod_radius_cdr/freeradius-client-1.1.6-configure-in.diff || echo "Assuming patch was applied previously" && autoreconf -v -f -i -s && $(DEFAULT_VARS) CFLAGS="${CFLAGS} -Wno-cpp" $(RADCLIENT_DIR)/configure $(DEFAULT_ARGS) --srcdir=$(RADCLIENT_DIR)
$(TOUCH_TARGET)
$(RADCLIENT_LA): $(RADCLIENT_BUILDDIR)/Makefile
@ -17,7 +17,7 @@
+@@ -234,13 +234,11 @@ AC_LINK_IFELSE([AC_LANG_PROGRAM([
+ enable_getrandom=getentropy],
+ [AC_MSG_RESULT(no)])
+
+
+-AC_MSG_CHECKING([for /dev/urandom])
+-if test -c /dev/urandom
+-then
@ -31,5 +31,5 @@
++if test $ac_cv_dev_urandom = yes; then
++ AC_DEFINE(HAVE_DEV_URANDOM)
+ fi
+
+
+ AC_ARG_WITH([nettle], [AS_HELP_STRING([--with-nettle],

View file

@ -1,10 +0,0 @@
--- a/libs/freetdm/mod_freetdm/Makefile.in
+++ b/libs/freetdm/mod_freetdm/Makefile.in
@@ -15,7 +15,6 @@ $(FTLA): $(FT_DIR)/.update
cd $(FT_DIR) && $(MAKE)
local_install:
- cd $(FT_DIR) && $(MAKE) install
[ -f $(DESTDIR)@confdir@/autoload_configs/freetdm.conf.xml ] || cp -f $(FT_DIR)/conf/freetdm.conf.xml $(DESTDIR)@confdir@/autoload_configs
local_clean:

View file

@ -1,10 +0,0 @@
--- a/src/mod/applications/mod_spandsp/Makefile.am
+++ b/src/mod/applications/mod_spandsp/Makefile.am
@@ -4,6 +4,6 @@ MODNAME=mod_spandsp
mod_LTLIBRARIES = mod_spandsp.la
mod_spandsp_la_SOURCES = mod_spandsp.c udptl.c mod_spandsp_fax.c mod_spandsp_dsp.c mod_spandsp_codecs.c mod_spandsp_modem.c
mod_spandsp_la_CFLAGS = $(AM_CFLAGS)
-mod_spandsp_la_CPPFLAGS = $(SPANDSL_CFLAGS) -I.
+mod_spandsp_la_CPPFLAGS = $(SPANDSP_CFLAGS) -I.
mod_spandsp_la_LIBADD = $(switch_builddir)/libfreeswitch.la $(SPANDSP_LIBS) -ljpeg -lz -ltiff
mod_spandsp_la_LDFLAGS = -avoid-version -module -no-undefined -shared

View file

@ -1,24 +0,0 @@
--- a/src/mod/endpoints/mod_gsmopen/Makefile.am
+++ b/src/mod/endpoints/mod_gsmopen/Makefile.am
@@ -1,19 +1,9 @@
include $(top_srcdir)/build/modmake.rulesam
MODNAME=mod_gsmopen
-SPANDSP_DIR=$(switch_srcdir)/libs/spandsp
-SPANDSP_BUILDDIR=$(switch_builddir)/libs/spandsp
-SPANDSP_LA=$(SPANDSP_BUILDDIR)/src/libspandsp.la
-
mod_LTLIBRARIES = mod_gsmopen.la
mod_gsmopen_la_SOURCES = mod_gsmopen.cpp gsmopen_protocol.cpp
mod_gsmopen_la_CXXFLAGS = $(SWITCH_AM_CXXFLAGS)
-mod_gsmopen_la_CPPFLAGS = -I$(SPANDSP_DIR)/src -I$(SPANDSP_BUILDDIR)/src -I.
-mod_gsmopen_la_LIBADD = $(switch_builddir)/libfreeswitch.la $(SPANDSP_LA)
+mod_gsmopen_la_CPPFLAGS = $(SPANDSP_CFLAGS) -I.
+mod_gsmopen_la_LIBADD = $(switch_builddir)/libfreeswitch.la $(SPANDSP_LIBS)
mod_gsmopen_la_LDFLAGS = -avoid-version -module -no-undefined -lctb-0.16 -lgsmme
-
-BUILT_SOURCES = $(SPANDSP_LA)
-
-$(SPANDSP_LA): $(SPANDSP_DIR) $(SPANDSP_DIR)/.update
- cd $(SPANDSP_BUILDDIR) && $(MAKE) CPPFLAGS="$(CPPFLAGS)" CFLAGS="$(CFLAGS)"
- $(TOUCH_TARGET)

View file

@ -1,6 +1,6 @@
--- a/src/switch_console.c
+++ b/src/switch_console.c
@@ -1051,10 +1051,12 @@ static void *SWITCH_THREAD_FUNC console_
@@ -1052,10 +1052,12 @@ static void *SWITCH_THREAD_FUNC console_
while (running) {
int32_t arg = 0;

View file

@ -1,6 +1,6 @@
--- a/configure.ac
+++ b/configure.ac
@@ -703,7 +703,7 @@ PKG_CHECK_MODULES([MARIADB], [libmariadb
@@ -709,7 +709,7 @@ PKG_CHECK_MODULES([MARIADB], [libmariadb
])
])

View file

@ -1,18 +0,0 @@
commit 9c01bd4c78c678e989ac77522145d3bd46352f6f
Author: Ciprian <ciprian.dosoftei@gmail.com>
Date: Tue Sep 1 12:13:28 2020 -0400
[mod_rayo] Enable -fno-common compilation
--- a/src/mod/event_handlers/mod_rayo/iks_helpers.h
+++ b/src/mod/event_handlers/mod_rayo/iks_helpers.h
@@ -51,8 +51,7 @@ struct xmpp_error {
#undef XMPP_ERROR
#define XMPP_ERROR(def_name, name, type) \
- SWITCH_DECLARE(const struct xmpp_error) def_name##_val; \
- SWITCH_DECLARE(const struct xmpp_error *) def_name;
+ extern const struct xmpp_error *def_name;
#include "xmpp_errors.def"
/* See RFC-3920 XMPP core for error definitions */

View file

@ -0,0 +1,11 @@
--- a/src/switch_rtp.c
+++ b/src/switch_rtp.c
@@ -2155,7 +2155,7 @@ static void switch_send_rtcp_event(switc
switch_event_add_header_string(event, SWITCH_STACK_BOTTOM, header, value);
snprintf(header, sizeof(header), "Source-Lost");
#if SWITCH_BYTE_ORDER == __BIG_ENDIAN
- tmpLost = report->lost; /* signed 24bit will extended signess to int32_t automatically */
+ tmpLost = rtcp_report_block->lost; /* signed 24bit will extended signess to int32_t automatically */
#else
tmpLost = ntohl(rtcp_report_block->lost)>>8;
tmpLost = tmpLost | ((tmpLost & 0x00800000) ? 0xff000000 : 0x00000000); /* ...and signess compensation */

View file

@ -1,16 +0,0 @@
--- a/src/include/switch_platform.h
+++ b/src/include/switch_platform.h
@@ -270,9 +270,13 @@ typedef intptr_t switch_ssize_t;
#if defined(__FreeBSD__) && SIZEOF_VOIDP == 4
#define TIME_T_FMT "d"
#else
+#if __USE_TIME_BITS64
+#define TIME_T_FMT SWITCH_INT64_T_FMT
+#else
#define TIME_T_FMT "ld"
#endif
#endif
+#endif
#if UINTPTR_MAX == 0xffffffffffffffff

View file

@ -0,0 +1,20 @@
--- a/src/mod/formats/mod_opusfile/mod_opusfile.c
+++ b/src/mod/formats/mod_opusfile/mod_opusfile.c
@@ -930,7 +930,7 @@ static int decode_stream_cb(void *dconte
if (globals.debug) {
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "[OGG/OPUS Stream Decode] decode CB called: context: %p data: %p packet_len: %d\n",
(void *)context, data, nbytes);
- switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "[OGG/OPUS Stream Decode] decode_stream_cb(): switch_thread_self(): %lx\n", switch_thread_self());
+ switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "[OGG/OPUS Stream Decode] decode_stream_cb(): switch_thread_self(): %lx\n", (unsigned long)(intptr_t)switch_thread_self());
}
switch_mutex_lock(context->ogg_mutex);
@@ -973,7 +973,7 @@ static void *SWITCH_THREAD_FUNC read_str
int buffered_ogg_bytes;
if (globals.debug) {
- switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "[OGG/OPUS Stream Decode] read_stream_thread(): switch_thread_self(): 0x%lx\n", switch_thread_self());
+ switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "[OGG/OPUS Stream Decode] read_stream_thread(): switch_thread_self(): 0x%lx\n", (unsigned long)(intptr_t)switch_thread_self());
}
switch_thread_rwlock_rdlock(context->rwlock);
switch_mutex_lock(context->ogg_mutex);

View file

@ -0,0 +1,46 @@
--- a/configure.ac
+++ b/configure.ac
@@ -1853,36 +1853,24 @@ then
fi
AC_MSG_RESULT([$PYTHON3_VER])
- AC_MSG_CHECKING([for python3 distutils])
- python3_result="`$PYTHON3 -c 'import distutils;' 2>&1`"
- if test -z "$python3_result" ; then
+ #AC_MSG_CHECKING([for python3 distutils])
+ #python3_result="`$PYTHON3 -c 'import distutils;' 2>&1`"
+ #if test -z "$python3_result" ; then
python3_has_distutils="yes"
- else
- python3_has_distutils="no"
- fi
- AC_MSG_RESULT([$python3_has_distutils])
+ #else
+ # python3_has_distutils="no"
+ #fi
+ #AC_MSG_RESULT([$python3_has_distutils])
if test "$python3_has_distutils" != "no" ; then
AC_MSG_CHECKING([location of python3 site-packages])
- PYTHON3_SITE_DIR="`$PYTHON3 -c 'from distutils import sysconfig; print(sysconfig.get_python_lib(0));'`"
-
if test -z "$PYTHON3_SITE_DIR" ; then
AC_MSG_ERROR([Unable to detect python3 site-packages path])
- elif test ! -d "$PYTHON3_SITE_DIR" ; then
- AC_MSG_ERROR([Path $PYTHON3_SITE_DIR returned by python3 does not exist!])
fi
AC_MSG_RESULT([$PYTHON3_SITE_DIR])
AC_SUBST([PYTHON3_SITE_DIR], [$PYTHON3_SITE_DIR])
- #
- # python3 distutils found, get settings from python3 directly
- #
- PYTHON3_CFLAGS="`$PYTHON3 -c 'from distutils import sysconfig; flags = [[\"-I\" + sysconfig.get_python_inc(0), \"-I\" + sysconfig.get_python_inc(1), \" \".join(sysconfig.get_config_var(\"CFLAGS\").split())]]; print(\" \".join(flags));' | sed -e 's/-arch i386//g;s/-arch x86_64//g'`"
- PYTHON3_LDFLAGS="`$PYTHON3 -c 'from distutils import sysconfig; ldver = sysconfig.get_config_var(\"LDVERSION\"); libs = sysconfig.get_config_var(\"LIBS\").split() + sysconfig.get_config_var(\"SYSLIBS\").split(); libs.append(\"-lpython\" + [[ldver,sysconfig.get_config_var(\"VERSION\")]][[ldver==None]]); print(\" \".join(libs));'`"
- PYTHON3_LIB="`$PYTHON3 -c 'from distutils import sysconfig; ldver = sysconfig.get_config_var(\"LDVERSION\"); print(\"python\" + [[ldver,sysconfig.get_config_var(\"VERSION\")]][[ldver==None]]);'`"
- PYTHON3_LIBDIR="`$PYTHON3 -c 'from distutils import sysconfig; print(sysconfig.get_config_var(\"LIBDIR\"));'`"
-
# handle python3 being installed into /usr/local
AC_MSG_CHECKING([python3 libdir])
if test -z "`echo $PYTHON3_LIBDIR | grep "/usr/lib"`" ; then

View file

@ -0,0 +1,43 @@
--- a/libs/esl/Makefile.am
+++ b/libs/esl/Makefile.am
@@ -82,7 +82,7 @@ pymod: $(MYLIB)
$(MAKE) PYTHON=$(PYTHON) MYLIB="../$(MYLIB)" SOLINK="$(SOLINK)" CFLAGS="-I$(switch_srcdir)/libs/esl/src/include $(SWITCH_AM_CFLAGS)" CXXFLAGS="-I$(switch_srcdir)/libs/esl/src/include $(SWITCH_AM_CXXFLAGS)" CXX_CFLAGS="$(CXX_CFLAGS)" -C python
py3mod: $(MYLIB)
- $(MAKE) PYTHON3=$(PYTHON3) MYLIB="../$(MYLIB)" SOLINK="$(SOLINK)" CFLAGS="-I$(switch_srcdir)/libs/esl/src/include $(SWITCH_AM_CFLAGS)" CXXFLAGS="-I$(switch_srcdir)/libs/esl/src/include $(SWITCH_AM_CXXFLAGS)" CXX_CFLAGS="$(CXX_CFLAGS)" -C python3
+ $(MAKE) PYTHON3=$(PYTHON3) MYLIB="../$(MYLIB)" SOLINK="$(SOLINK)" CFLAGS="-I$(switch_srcdir)/libs/esl/src/include $(SWITCH_AM_CFLAGS)" CXXFLAGS="-I$(switch_srcdir)/libs/esl/src/include $(SWITCH_AM_CXXFLAGS)" CXX_CFLAGS="$(CXX_CFLAGS)" PYTHON3_CFLAGS="$(PYTHON3_CFLAGS)" PYTHON3_LDFLAGS="$(PYTHON3_LDFLAGS)" -C python3
tclmod: $(MYLIB)
$(MAKE) MYLIB="../$(MYLIB)" SOLINK="$(SOLINK)" CFLAGS="-I$(switch_srcdir)/libs/esl/src/include $(SWITCH_AM_CFLAGS)" CXXFLAGS="-I$(switch_srcdir)/libs/esl/src/include $(SWITCH_AM_CXXFLAGS)" CXX_CFLAGS="$(CXX_CFLAGS)" -C tcl
@@ -106,7 +106,7 @@ pymod-install: pymod
$(MAKE) PYTHON=$(PYTHON) -C python install
py3mod-install: py3mod
- $(MAKE) PYTHON3=$(PYTHON3) -C python3 install
+ $(MAKE) PYTHON3=$(PYTHON3) PYTHON3_SITE_DIR="$(PYTHON3_SITE_DIR)" -C python3 install
rubymod-install: rubymod
$(MAKE) -C ruby install
--- a/libs/esl/python3/Makefile
+++ b/libs/esl/python3/Makefile
@@ -1,6 +1,4 @@
-LOCAL_CFLAGS=`$(PYTHON3) ./python-config --includes`
-LOCAL_LDFLAGS=`$(PYTHON3) ./python-config --ldflags`
-SITE_DIR=$(DESTDIR)/`$(PYTHON3) -c "from distutils.sysconfig import get_python_lib; print (get_python_lib(1))"`
+SITE_DIR=$(DESTDIR)/$(PYTHON3_SITE_DIR)
all: _ESL.so
@@ -8,10 +6,10 @@ esl_wrap.cpp:
swig3.0 -module ESL -classic -python -c++ -DMULTIPLICITY -threads -I../src/include -o esl_wrap.cpp ../ESL.i
esl_wrap.o: esl_wrap.cpp
- $(CXX) $(CXX_CFLAGS) $(CXXFLAGS) $(LOCAL_CFLAGS) -c esl_wrap.cpp -o esl_wrap.o
+ $(CXX) $(CXX_CFLAGS) $(CXXFLAGS) $(PYTHON3_CFLAGS) -c esl_wrap.cpp -o esl_wrap.o
_ESL.so: esl_wrap.o
- $(CXX) $(SOLINK) esl_wrap.o $(MYLIB) $(LOCAL_LDFLAGS) -o _ESL.so -L. $(LIBS)
+ $(CXX) $(SOLINK) esl_wrap.o $(MYLIB) $(PYTHON3_LDFLAGS) -o _ESL.so -L. $(LIBS)
install: _ESL.so
mkdir -p $(SITE_DIR)

View file

@ -0,0 +1,118 @@
commit a2ce46c6fde38d6ac54a8a2ee1a5b391e2ed2071
Author: Sebastian Kemper <sebastian_ml@gmx.net>
Date: Mon Nov 1 09:59:09 2021 +0100
[core] fix "--disable-libyuv"
Recent changes made it impossible to compile freeswitch without libyuv
support.
src/switch_core_video.c: In function 'switch_img_read_from_file':
src/switch_core_video.c:3139:4: error: implicit declaration of function 'RAWToI420' [-Werror=implicit-function-declaration]
RAWToI420(data, width * 3,
^
src/switch_core_video.c:3148:4: error: implicit declaration of function 'ABGRToARGB' [-Werror=implicit-function-declaration]
ABGRToARGB(data, width * 4, img->planes[SWITCH_PLANE_PACKED], img->stride[SWITCH_PLANE_PACKED], width, height);
^
Fix this my adding/moving the checks for "SWITCH_HAVE_YUV".
Signed-off-by: Sebastian Kemper <sebastian_ml@gmx.net>
--- a/src/switch_core_video.c
+++ b/src/switch_core_video.c
@@ -3116,6 +3116,7 @@ SWITCH_DECLARE(switch_status_t) switch_i
SWITCH_DECLARE(switch_image_t *) switch_img_read_from_file(const char* file_name, switch_img_fmt_t img_fmt)
{
+#ifdef SWITCH_HAVE_YUV
int width = 0, height = 0, channels = 0;
int comp = STBI_rgb;
unsigned char *data = NULL;
@@ -3155,12 +3156,16 @@ SWITCH_DECLARE(switch_image_t *) switch_
} else if (data) {
stbi_image_free(data);
}
+#endif
return NULL;
}
SWITCH_DECLARE(switch_status_t) switch_img_write_to_file(switch_image_t *img, const char* file_name, int quality)
{
+#ifndef SWITCH_HAVE_YUV
+ return SWITCH_STATUS_FALSE;
+#else
int comp = STBI_rgb;
unsigned char *data = NULL;
const char *ext = strrchr(file_name, '.');
@@ -3217,6 +3222,7 @@ SWITCH_DECLARE(switch_status_t) switch_i
free(data);
return ret ? SWITCH_STATUS_SUCCESS : SWITCH_STATUS_FALSE;
+#endif
}
typedef struct data_url_context_s {
@@ -3224,14 +3230,19 @@ typedef struct data_url_context_s {
char **urlP;
} data_url_context_t;
+#ifdef SWITCH_HAVE_YUV
static void data_url_write_func(void *context, void *data, int size)
{
switch_buffer_t *buffer = (switch_buffer_t *)context;
switch_buffer_write(buffer, data, size);
}
+#endif
SWITCH_DECLARE(switch_status_t) switch_img_data_url(switch_image_t *img, char **urlP, const char *type, int quality)
{
+#ifndef SWITCH_HAVE_YUV
+ return SWITCH_STATUS_FALSE;
+#else
int comp = STBI_rgb;
unsigned char *data = NULL;
int stride_in_bytes = 0;
@@ -3300,6 +3311,7 @@ SWITCH_DECLARE(switch_status_t) switch_i
switch_buffer_destroy(&buffer);
return ret ? SWITCH_STATUS_SUCCESS : SWITCH_STATUS_FALSE;
+#endif /* SWITCH_HAVE_YUV */
}
--- a/tests/unit/switch_core_video.c
+++ b/tests/unit/switch_core_video.c
@@ -48,6 +48,7 @@ FST_CORE_BEGIN("./conf")
}
FST_TEARDOWN_END()
+#ifdef SWITCH_HAVE_YUV
FST_TEST_BEGIN(data_url_test)
{
char *data_url = NULL;
@@ -88,6 +89,7 @@ FST_CORE_BEGIN("./conf")
unlink(argb_filename);
}
FST_TEST_END()
+#endif /* SWITCH_HAVE_YUV */
FST_TEST_BEGIN(img_patch)
{
@@ -239,6 +241,7 @@ FST_CORE_BEGIN("./conf")
}
FST_TEST_END()
+#ifdef SWITCH_HAVE_YUV
FST_TEST_BEGIN(stb_data_url)
{
switch_image_t *img = switch_img_alloc(NULL, SWITCH_IMG_FMT_I420, 120, 60, 1);
@@ -321,6 +324,7 @@ FST_CORE_BEGIN("./conf")
unlink(jpg_write_filename);
}
FST_TEST_END()
+#endif /* SWITCH_HAVE_YUV */
}
FST_SUITE_END()
}

View file

@ -10,7 +10,7 @@ include $(TOPDIR)/rules.mk
PKG_NAME:=restund
PKG_VERSION:=0.4.12
PKG_RELEASE:=8
PKG_RELEASE:=9
PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.gz
PKG_SOURCE_URL:=http://www.creytiv.com/pub

View file

@ -0,0 +1,69 @@
From ffa2d56cac3d37715fe1381df81802774240da92 Mon Sep 17 00:00:00 2001
From: Dusan Stevanovic <dule@wire.com>
Date: Thu, 11 Mar 2021 10:58:32 +0100
Subject: [PATCH] turn: block forwarding to loopback/any
---
modules/turn/turn.c | 18 ++++++++++++++----
1 file changed, 14 insertions(+), 4 deletions(-)
--- a/modules/turn/turn.c
+++ b/modules/turn/turn.c
@@ -153,6 +153,7 @@ static bool indication_handler(struct re
struct stun_attr *data, *peer;
struct allocation *al;
struct perm *perm;
+ const struct sa *psa;
int err;
(void)sock;
(void)ctx;
@@ -173,13 +174,17 @@ static bool indication_handler(struct re
if (!peer || !data)
return true;
- perm = perm_find(al->perms, &peer->v.xor_peer_addr);
+ psa = &peer->v.xor_peer_addr;
+ perm = perm_find(al->perms, psa);
if (!perm) {
++al->dropc_tx;
return true;
}
- err = udp_send(al->rel_us, &peer->v.xor_peer_addr, &data->v.data);
+ if (sa_is_loopback(psa) || sa_is_any(psa))
+ err = EPERM;
+ else
+ err = udp_send(al->rel_us, psa, &data->v.data);
if (err)
turnd.errc_tx++;
else {
@@ -200,6 +205,7 @@ static bool raw_handler(int proto, const
uint16_t numb, len;
struct perm *perm;
struct chan *chan;
+ const struct sa *psa;
int err;
al = allocation_find(proto, src, dst);
@@ -219,7 +225,8 @@ static bool raw_handler(int proto, const
if (!chan)
return false;
- perm = perm_find(al->perms, chan_peer(chan));
+ psa = chan_peer(chan);
+ perm = perm_find(al->perms, psa);
if (!perm) {
++al->dropc_tx;
return false;
@@ -227,7 +234,10 @@ static bool raw_handler(int proto, const
mb->end = mb->pos + len;
- err = udp_send(al->rel_us, chan_peer(chan), mb);
+ if (sa_is_loopback(psa) || sa_is_any(psa))
+ err = EPERM;
+ else
+ err = udp_send(al->rel_us, psa, mb);
if (err)
turnd.errc_tx++;
else {

View file

@ -0,0 +1,29 @@
From e2f4094e23c73d4563a55f0de72244f34bb5b702 Mon Sep 17 00:00:00 2001
From: Dusan Stevanovic <dule@wire.com>
Date: Thu, 11 Mar 2021 11:53:50 +0100
Subject: [PATCH] turn: also don't forward linklocal addresses
---
modules/turn/turn.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
--- a/modules/turn/turn.c
+++ b/modules/turn/turn.c
@@ -181,7 +181,7 @@ static bool indication_handler(struct re
return true;
}
- if (sa_is_loopback(psa) || sa_is_any(psa))
+ if (sa_is_loopback(psa) || sa_is_any(psa) || sa_is_linklocal(psa))
err = EPERM;
else
err = udp_send(al->rel_us, psa, &data->v.data);
@@ -234,7 +234,7 @@ static bool raw_handler(int proto, const
mb->end = mb->pos + len;
- if (sa_is_loopback(psa) || sa_is_any(psa))
+ if (sa_is_loopback(psa) || sa_is_any(psa) || sa_is_linklocal(psa))
err = EPERM;
else
err = udp_send(al->rel_us, psa, mb);

View file

@ -0,0 +1,52 @@
From 955064fc220b5739010a2e207a8561ea44f974d3 Mon Sep 17 00:00:00 2001
From: Dusan Stevanovic <dule@wire.com>
Date: Thu, 11 Mar 2021 13:15:27 +0100
Subject: [PATCH] turn: block whole loopback range, also block broadcast
---
modules/turn/turn.c | 20 ++++++++++++++++++--
1 file changed, 18 insertions(+), 2 deletions(-)
--- a/modules/turn/turn.c
+++ b/modules/turn/turn.c
@@ -144,6 +144,22 @@ static bool request_handler(struct restu
return true;
}
+static inline bool is_loopback(const struct sa *sa)
+{
+ return (ntohl(sa->u.in.sin_addr.s_addr) & 0xffffff00) == 0x7f000000;
+}
+
+static inline bool is_broadcast(const struct sa *sa)
+{
+ return ntohl(sa->u.in.sin_addr.s_addr) == 0xffffffff;
+}
+
+static inline bool is_blocked(const struct sa *sa)
+{
+ return is_loopback(sa) || is_broadcast(sa)
+ || sa_is_any(sa) || sa_is_linklocal(sa);
+
+}
static bool indication_handler(struct restund_msgctx *ctx, int proto,
void *sock, const struct sa *src,
@@ -181,7 +197,7 @@ static bool indication_handler(struct re
return true;
}
- if (sa_is_loopback(psa) || sa_is_any(psa) || sa_is_linklocal(psa))
+ if (is_blocked(psa))
err = EPERM;
else
err = udp_send(al->rel_us, psa, &data->v.data);
@@ -234,7 +250,7 @@ static bool raw_handler(int proto, const
mb->end = mb->pos + len;
- if (sa_is_loopback(psa) || sa_is_any(psa) || sa_is_linklocal(psa))
+ if (is_blocked(psa))
err = EPERM;
else
err = udp_send(al->rel_us, psa, mb);

View file

@ -9,14 +9,14 @@ include $(TOPDIR)/rules.mk
include $(INCLUDE_DIR)/kernel.mk
PKG_NAME:=rtpengine
PKG_VERSION:=8.5.3.2
PKG_VERSION:=8.5.5.1
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:=7f463f1f23067d7f69c334e04710348ce95cd637c340724b3042d44083ccba07
PKG_HASH:=962368495343d6e7d3e9c45a8a8499972c2af3cd068f4758f3d2abf40a465d84
PKG_BUILD_DIR:=$(KERNEL_BUILD_DIR)/$(PKG_NAME)-$(BUILD_VARIANT)/$(PKG_NAME)-mr$(PKG_VERSION)
PKG_BUILD_DIR:=$(BUILD_DIR)/$(PKG_NAME)-$(BUILD_VARIANT)/$(PKG_NAME)-mr$(PKG_VERSION)
PKG_LICENSE:=GPL-3.0
PKG_LICENSE_FILES:=LICENSE
@ -31,6 +31,10 @@ PKG_BUILD_PARALLEL:=0
PKG_BUILD_DEPENDS:=gperf/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
@ -60,7 +64,9 @@ RECORDING_DEPENDS := \
+libmariadb \
+libopenssl
RTPENGINE_USERID:=$(PKG_NAME)=378:$(PKG_NAME)=378
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
@ -72,7 +78,7 @@ $(call Package/rtpengine/Default)
CATEGORY:=Network
SECTION:=net
SUBMENU:=Telephony
USERID:=$(RTPENGINE_USERID)
USERID:=$(RTPENGINE_USER)
endef
define Package/rtpengine/description/Template
@ -151,7 +157,7 @@ $(call Package/rtpengine/Default)
CATEGORY:=Network
SECTION:=net
SUBMENU:=Telephony
USERID:=$(RTPENGINE_USERID)
USERID:=$(RTPENGINE_USER)
DEPENDS:=$(patsubst +%,+PACKAGE_rtpengine-recording:%,$(RECORDING_DEPENDS))
endef
@ -205,8 +211,13 @@ $(call Package/rtpengine/Default)
+PACKAGE_kmod-ipt-rtpengine:kmod-crypto-hash \
+PACKAGE_kmod-ipt-rtpengine:kmod-ipt-core
MODPARAMS.xt_RTPENGINE := \
proc_uid=$(PKG_NAME) \
proc_gid=$(PKG_NAME)
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
@ -239,10 +250,10 @@ 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) \
ARCH=$(LINUX_KARCH) \
CROSS_COMPILE=$(TARGET_CROSS)
$(KERNEL_MAKE_FLAGS)
endif
ifneq ($(CONFIG_PACKAGE_iptables-mod-rtpengine),)
@ -262,8 +273,10 @@ endef
define Build/InstallDev
endef
$(eval $(call BuildPackage,rtpengine-no-transcode))
# 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))

View file

@ -9,14 +9,16 @@ include $(TOPDIR)/rules.mk
PKG_NAME:=sngrep
PKG_VERSION:=1.4.8
PKG_RELEASE:=1
PKG_MAINTAINER:=Sebastian Kemper <sebastian_ml@gmx.net>
PKG_LICENSE:=GPL-3.0+
PKG_LICENSE_FILES:=COPYING
PKG_SOURCE_URL:=https://github.com/irontec/sngrep.git
PKG_SOURCE_PROTO:=git
PKG_SOURCE_VERSION:=564ad9264ebe8b77ed18a923fef3643de920087c
PKG_SOURCE_DATE=2019-12-02
PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.gz
PKG_SOURCE_URL:=https://github.com/irontec/sngrep/releases/download/v$(PKG_VERSION)
PKG_HASH:=f39fded8dc9ef0b7a41319f223dd4afa348bb2418bea578ed281557726829728
PKG_RELEASE:=1

View file

@ -9,41 +9,46 @@
include $(TOPDIR)/rules.mk
PKG_NAME:=yate
PKG_VERSION:=6.1.0-1
PKG_RELEASE:=2
PKG_VERSION:=6.4.0-1
PKG_RELEASE:=1
PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.gz
PKG_SOURCE_URL:=http://yate.null.ro/tarballs/yate6/
PKG_HASH:=ed88519c8e2f63eec0d699bc6ed8831854af9b32b654b3d7e7c2697b528aa377
PKG_BUILD_DIR:=$(BUILD_DIR)/$(PKG_NAME)
PKG_HASH:=8c23dc6bffbf8d478db3a85964b5019771c8f6c9acf5220f3465516a748a03b0
PKG_LICENSE:=GPL-2.0
PKG_LICENSE_FILES:=COPYING
PKG_MAINTAINER:=Jiri Slachta <jiri@slachta.eu>
PKG_FIXUP:=autoreconf
PKG_BUILD_PARALLEL:=1
PKG_INSTALL:=1
# Yate currently does not compile with FORTIFY_SOURCE enabled
PKG_FORTIFY_SOURCE:=0
PKG_CONFIG_DEPENDS:= \
CONFIG_PACKAGE_$(PKG_NAME)-mod-zapcard \
CONFIG_PACKAGE_$(PKG_NAME)-mod-faxchan \
CONFIG_PACKAGE_$(PKG_NAME)-mod-g722webrtc \
CONFIG_PACKAGE_$(PKG_NAME)-mod-ilbccodec \
CONFIG_PACKAGE_$(PKG_NAME)-mod-ilbcwebrtc \
CONFIG_PACKAGE_$(PKG_NAME)-mod-isaccodec \
CONFIG_PACKAGE_$(PKG_NAME)-mod-pgsqldb \
CONFIG_PACKAGE_$(PKG_NAME)-mod-mysqldb \
CONFIG_PACKAGE_$(PKG_NAME)-mod-faxchan \
CONFIG_PACKAGE_$(PKG_NAME)-mod-openssl \
CONFIG_PACKAGE_$(PKG_NAME)-mod-pgsqldb \
CONFIG_PACKAGE_$(PKG_NAME)-mod-speexcodec \
CONFIG_PACKAGE_$(PKG_NAME)-mod-sqlitedb \
CONFIG_PACKAGE_$(PKG_NAME)-mod-zapcard \
CONFIG_PACKAGE_$(PKG_NAME)-mod-zlibcompress \
CONFIG_SOFT_FLOAT
include $(INCLUDE_DIR)/uclibc++.mk
include $(INCLUDE_DIR)/package.mk
# Needed for yate-mod-mysqldb to find iconv
include $(INCLUDE_DIR)/nls.mk
TAR_OPTIONS+= --strip-components 1
TAR_CMD=$(HOST_TAR) -C $(1) $(TAR_OPTIONS)
define Package/$(PKG_NAME)/Default
SUBMENU:=Telephony
SECTION:=net
@ -83,49 +88,38 @@ define Package/$(PKG_NAME)-sounds
TITLE := Sounds for Yate
endef
define Package/$(PKG_NAME)-collection-basic
$(call Package/yate/Default)
DEPENDS += $(PKG_NAME) \
+PACKAGE_$(PKG_NAME)-collection-basic:$(PKG_NAME)-sounds \
+PACKAGE_$(PKG_NAME)-collection-basic:$(PKG_NAME)-mod-dumbchan \
+PACKAGE_$(PKG_NAME)-collection-basic:$(PKG_NAME)-mod-regfile \
+PACKAGE_$(PKG_NAME)-collection-basic:$(PKG_NAME)-mod-regexroute \
+PACKAGE_$(PKG_NAME)-collection-basic:$(PKG_NAME)-mod-rmanager \
+PACKAGE_$(PKG_NAME)-collection-basic:$(PKG_NAME)-mod-tonegen \
+PACKAGE_$(PKG_NAME)-collection-basic:$(PKG_NAME)-mod-yrtpchan \
+PACKAGE_$(PKG_NAME)-collection-basic:$(PKG_NAME)-mod-ysipchan
TITLE := Basic Yate Server
endef
# Otherwise yate ignores CPPFLAGS
TARGET_CFLAGS += $(TARGET_CPPFLAGS)
CONFIGURE_ARGS+= \
$(if $(CONFIG_x86_64),--enable-sse2) \
--disable-sctp \
$(if $(CONFIG_PACKAGE_$(PKG_NAME)-mod-zapcard),,--disable-dahdi --disable-zaptel) \
--disable-wpcard \
--disable-tdmcard \
--disable-wanpipe \
--enable-ilbc \
$(if $(CONFIG_PACKAGE_$(PKG_NAME)-mod-ilbcwebrtc),--enable-ilbc-webrtc,--disable-ilbc-webrtc) \
$(if $(CONFIG_PACKAGE_$(PKG_NAME)-mod-pgsqldb),--with-libpq="$(STAGING_DIR)/usr",--without-libpq) \
$(if $(CONFIG_PACKAGE_$(PKG_NAME)-mod-mysqldb),--with-mysql=yes,--with-mysql=no) \
--without-wphwec \
--without-libgsm \
--disable-wpcard \
--without-amrnb \
$(if $(CONFIG_PACKAGE_$(PKG_NAME)-mod-faxchan),--with-spandsp="$(STAGING_DIR)/usr/include",--without-spandsp) \
--without-pwlib \
--without-openh323 \
$(if $(CONFIG_PACKAGE_$(PKG_NAME)-mod-openssl),--with-openssl,--without-openssl) \
$(if $(CONFIG_PACKAGE_$(PKG_NAME)-mod-zlibcompress),--with-zlib="$(STAGING_DIR)/usr",--without-zlib) \
--without-libqt4 \
--without-qtstatic \
--without-coredumper \
--without-doxygen \
--without-kdoc
--without-kdoc \
--without-libgsm \
--without-libqt4 \
--without-openh323 \
--without-pwlib \
--without-qtstatic \
--without-wphwec \
$(if $(CONFIG_x86_64),--enable-sse2) \
$(if $(CONFIG_PACKAGE_$(PKG_NAME)-mod-faxchan),--with-spandsp="$(STAGING_DIR)/usr/include",--without-spandsp) \
$(if $(CONFIG_PACKAGE_$(PKG_NAME)-mod-g722webrtc),--enable-g722-webrtc,--disable-g722-webrtc) \
$(if $(CONFIG_PACKAGE_$(PKG_NAME)-mod-ilbccodec),--enable-ilbc,--disable-ilbc) \
$(if $(CONFIG_PACKAGE_$(PKG_NAME)-mod-ilbcwebrtc),--enable-ilbc-webrtc,--disable-ilbc-webrtc) \
$(if $(CONFIG_PACKAGE_$(PKG_NAME)-mod-mysqldb),--with-mysql=yes,--without-mysql) \
$(if $(CONFIG_PACKAGE_$(PKG_NAME)-mod-openssl),--with-openssl,--without-openssl) \
$(if $(CONFIG_PACKAGE_$(PKG_NAME)-mod-pgsqldb),--with-libpq="$(STAGING_DIR)/usr",--without-libpq) \
$(if $(CONFIG_PACKAGE_$(PKG_NAME)-mod-speexcodec),--with-libspeex="$(STAGING_DIR)/usr/include",--without-libspeex) \
$(if $(CONFIG_PACKAGE_$(PKG_NAME)-mod-sqlitedb),--with-sqlite,--without-sqlite) \
$(if $(CONFIG_PACKAGE_$(PKG_NAME)-mod-zapcard),,--disable-dahdi --disable-zaptel) \
$(if $(CONFIG_PACKAGE_$(PKG_NAME)-mod-zlibcompress),--with-zlib="$(STAGING_DIR)/usr",--without-zlib)
# The regexp implementation of musl 1.1.19 is not fully compatible with yate
# The regexp implementation of musl 1.1.24 is not fully compatible with yate
CONFIGURE_ARGS+= \
--enable-internalregex
@ -139,11 +133,11 @@ endif
define Package/$(PKG_NAME)/install
$(INSTALL_DIR) $(1)/usr/lib
for yatelib in "" asn sig mgcp jabber script; do \
$(CP) $(PKG_INSTALL_DIR)/usr/lib/libyate$$$${yatelib}.so* $(1)/usr/lib ;\
done
$(INSTALL_DIR) $(1)/usr/bin
$(INSTALL_BIN) $(PKG_INSTALL_DIR)/usr/bin/yate $(1)/usr/bin/
$(INSTALL_DIR) $(1)/etc/$(PKG_NAME)
@ -163,9 +157,6 @@ define Package/$(PKG_NAME)-sounds/install
$(CP) $(PKG_INSTALL_DIR)/usr/share/yate/sounds/ $(1)/usr/share/yate/
endef
define Package/$(PKG_NAME)-collection-basic/install
endef
define Build/InstallDev
$(INSTALL_DIR) $(STAGING_DIR)/usr/include
$(CP) $(PKG_INSTALL_DIR)/usr/include/* $(STAGING_DIR)/usr/include/
@ -183,11 +174,11 @@ define BuildPlugin
define Package/$(PKG_NAME)-mod-$(subst _,-,$(1))/conffiles
$(if $(6),/etc/yate/$(1).conf)
endef
define Package/$(PKG_NAME)-mod-$(subst _,-,$(1))/description
$(3) module for $(PKG_NAME)
endef
define Package/$(PKG_NAME)-mod-$(subst _,-,$(1))/install
$$(INSTALL_DIR) $$(1)/usr/lib/yate/$(2)
$$(INSTALL_BIN) $$(PKG_INSTALL_DIR)/usr/lib/yate/$(2)/$(1).yate $$(1)/usr/lib/yate/$(2)/$(1).yate
@ -205,7 +196,6 @@ $(if $(6),/etc/yate/$(1).conf)
endef
$(eval $(call BuildPackage,$(PKG_NAME)))
$(eval $(call BuildPackage,$(PKG_NAME)-collection-basic))
$(eval $(call BuildPackage,$(PKG_NAME)-scripts-perl))
$(eval $(call BuildPackage,$(PKG_NAME)-sounds))
@ -245,6 +235,7 @@ $(eval $(call BuildPlugin,extmodule,,External Module Handler,,/usr/share/yate/sc
$(eval $(call BuildPlugin,faxchan,,Spandsp Fax Channel,+libspandsp))
$(eval $(call BuildPlugin,fileinfo,,File Info Holder,,,y))
$(eval $(call BuildPlugin,filetransfer,,File Transfer Driver,,,y))
$(eval $(call BuildPlugin,g722webrtc,,G.722 codec using library based on WebRTC project,))
$(eval $(call BuildPlugin,gvoice,,Google Voice support,,,y))
$(eval $(call BuildPlugin,heartbeat,server,Linux-HA compatible heartbeat,,,y))
$(eval $(call BuildPlugin,ilbccodec,,iLBC Codec,))
@ -280,6 +271,7 @@ $(eval $(call BuildPlugin,rmanager,,Yate Remote Management,,,y))
$(eval $(call BuildPlugin,sigtransport,server,SIGTRAN (SS7 over IP) connection provider,,,y))
$(eval $(call BuildPlugin,sip_cnam_lnp,sip,Query CNAM and LNP databases using SIP INVITE,,,y))
$(eval $(call BuildPlugin,sipfeatures,server,SIP Features (SUBSCRIBE/NOTIFY),,,y))
$(eval $(call BuildPlugin,speexcodec,,Speex codec module written by Olaf Conradi,+libspeex))
$(eval $(call BuildPlugin,sqlitedb,server,SQLite Support,+libsqlite3,,y))
$(eval $(call BuildPlugin,ss7_lnp_ansi,sig,Query LNP Databases,,,y))
$(eval $(call BuildPlugin,subscription,server,Subcription handler and presence notifier,,,y))
@ -288,6 +280,7 @@ $(eval $(call BuildPlugin,tonedetect,,Detectors for Various Tones,))
$(eval $(call BuildPlugin,tonegen,,Tones Generator,,,y))
$(eval $(call BuildPlugin,users,server,Users,,,y))
$(eval $(call BuildPlugin,wavefile,,Wav file Record and Playback,))
$(eval $(call BuildPlugin,wiresniff,,Capture interface for YATE messages,,,y))
$(eval $(call BuildPlugin,wpcard,server,Wanpipe PRI cards Signalling and Data Driver,@BROKEN)) # Mising wanpipe and PRI libraries
$(eval $(call BuildPlugin,yiaxchan,,IAX Channel,,,y))
$(eval $(call BuildPlugin,yjinglechan,,Jingle Channel,,,y))
@ -300,4 +293,3 @@ $(eval $(call BuildPlugin,ysockschan,,SOCKS Channel,,,y))
$(eval $(call BuildPlugin,ystunchan,,STUN Support,,,y))
$(eval $(call BuildPlugin,zapcard,server,Zaptel PRI/TDM/FXS/FXO cards,@!aarch64 +kmod-dahdi,,y))
$(eval $(call BuildPlugin,zlibcompress,,Zlib Compression,+zlib,,y))

View file

@ -1,11 +0,0 @@
--- a/configure.ac
+++ b/configure.ac
@@ -713,7 +713,7 @@ if [[ "x$local_lib" != "xlib" -a ! -d "$
fi
if [[ -f "$ac_cv_use_mysql/include/mysql/mysql.h" -a -d "$ac_cv_use_mysql/$local_lib/mysql" ]]; then
MYSQL_INC="-I$ac_cv_use_mysql/include/mysql"
-MYSQL_LIB="-L$ac_cv_use_mysql/$local_lib/mysql -lmysqlclient_r -lpthread -lz -lcrypt -lnsl -lm"
+MYSQL_LIB="-L$ac_cv_use_mysql/$local_lib/mysql -lmysqlclient_r -lpthread -lz -lcrypt -lm"
MYSQL_VER=`sed -n 's/^.*MYSQL_SERVER_VERSION[[^"]]*"\([[^"]]*\).*$/\1/p' "$ac_cv_use_mysql/include/mysql/mysql_version.h"`
HAVE_MYSQL=yes
fi

View file

@ -1,49 +0,0 @@
--- a/engine/Thread.cpp
+++ b/engine/Thread.cpp
@@ -106,21 +106,18 @@ static DWORD getTls()
return tls_index;
}
#else /* _WINDOWS */
-static pthread_key_t current_key;
-
-class ThreadPrivateKeyAlloc
+static pthread_key_t& current_key()
{
-public:
- ThreadPrivateKeyAlloc()
- {
- if (::pthread_key_create(&current_key,ThreadPrivate::destroyFunc)) {
+ static pthread_key_t* current_key = NULL;
+ if (!current_key) {
+ current_key = new pthread_key_t;
+ if (::pthread_key_create(current_key, ThreadPrivate::destroyFunc)) {
abortOnBug(true);
Debug(DebugFail,"Failed to create current thread key!");
}
}
-};
-
-static ThreadPrivateKeyAlloc keyAllocator;
+ return *current_key;
+}
#endif /* _WINDOWS */
static TokenDict s_prio[] = {
@@ -309,7 +306,7 @@ void ThreadPrivate::run()
#ifdef _WINDOWS
::TlsSetValue(getTls(),this);
#else
- ::pthread_setspecific(current_key,this);
+ ::pthread_setspecific(current_key(),this);
pthread_cleanup_push(cleanupFunc,this);
#ifdef PTHREAD_CANCEL_ASYNCHRONOUS
::pthread_setcanceltype(PTHREAD_CANCEL_ASYNCHRONOUS,0);
@@ -421,7 +418,7 @@ ThreadPrivate* ThreadPrivate::current()
#ifdef _WINDOWS
return reinterpret_cast<ThreadPrivate *>(::TlsGetValue(getTls()));
#else
- return reinterpret_cast<ThreadPrivate *>(::pthread_getspecific(current_key));
+ return reinterpret_cast<ThreadPrivate *>(::pthread_getspecific(current_key()));
#endif
}

View file

@ -1,32 +0,0 @@
--- a/libs/ysdp/parser.cpp
+++ b/libs/ysdp/parser.cpp
@@ -59,6 +59,7 @@ const TokenDict SDPParser::s_payloads[]
{ "h263-2000", 112 },
{ "h264", 114 },
{ "vp8", 113 },
+ { "vp9", 115 },
{ "mpv", 32 },
{ "mp2t", 33 },
{ "mp4v", 110 },
@@ -95,6 +96,7 @@ const TokenDict SDPParser::s_rtpmap[] =
{ "H263-2000/90000", 112 },
{ "H264/90000", 114 },
{ "VP8/90000", 113 },
+ { "VP9/90000", 115 },
{ "MPV/90000", 32 },
{ "MP2T/90000", 33 },
{ "MP4V-ES/90000", 110 },
--- a/modules/yrtpchan.cpp
+++ b/modules/yrtpchan.cpp
@@ -63,6 +63,11 @@ static TokenDict dict_payloads[] = {
{ "mjpeg", 26 },
{ "h261", 31 },
{ "h263", 34 },
+ { "h263-1998", 111 },
+ { "h263-2000", 112 },
+ { "h264", 114 },
+ { "vp8", 113 },
+ { "vp9", 115 },
{ "mpv", 32 },
{ "mp2t", 33 },
{ "mp4v", 98 },