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
178 changed files with 5219 additions and 8356 deletions

63
.circleci/Dockerfile Normal file
View file

@ -0,0 +1,63 @@
FROM debian:9
# Configuration version history
# v1.0 - Initial version by Etienne Champetier
# v1.0.1 - Run as non-root, add unzip, xz-utils
# v1.0.2 - Add bzr
# v1.0.3 - Verify usign signatures
# v1.0.4 - Add support for Python3
# v1.0.5 - Add 19.07 public keys, verify keys
RUN apt update && apt install -y \
build-essential \
bzr \
curl \
jq \
gawk \
gettext \
git \
libncurses5-dev \
libssl-dev \
python \
python3 \
signify-openbsd \
subversion \
time \
unzip \
wget \
xz-utils \
zlib1g-dev \
&& rm -rf /var/lib/apt/lists/*
RUN useradd -c "OpenWrt Builder" -m -d /home/build -s /bin/bash build
USER build
ENV HOME /home/build
# OpenWrt Build System (PGP key for unattended snapshot builds)
RUN curl 'https://git.openwrt.org/?p=keyring.git;a=blob_plain;f=gpg/626471F1.asc' | gpg --import \
&& gpg --fingerprint --with-colons '<pgpsign-snapshots@openwrt.org>' | grep '^fpr:::::::::54CC74307A2C6DC9CE618269CD84BCED626471F1:$' \
&& echo '54CC74307A2C6DC9CE618269CD84BCED626471F1:6:' | gpg --import-ownertrust
# OpenWrt Build System (PGP key for 17.01 "Reboot" release builds)
RUN curl 'https://git.openwrt.org/?p=keyring.git;a=blob_plain;f=gpg/D52BBB6B.asc' | gpg --import \
&& gpg --fingerprint --with-colons '<pgpsign-17.01@openwrt.org>' | grep '^fpr:::::::::B09BE781AE8A0CD4702FDCD3833C6010D52BBB6B:$' \
&& echo 'B09BE781AE8A0CD4702FDCD3833C6010D52BBB6B:6:' | gpg --import-ownertrust
# OpenWrt Release Builder (18.06 Signing Key)
RUN curl 'https://git.openwrt.org/?p=keyring.git;a=blob_plain;f=gpg/17E1CE16.asc' | gpg --import \
&& gpg --fingerprint --with-colons '<openwrt-devel@lists.openwrt.org>' | grep '^fpr:::::::::6768C55E79B032D77A28DA5F0F20257417E1CE16:$' \
&& echo '6768C55E79B032D77A28DA5F0F20257417E1CE16:6:' | gpg --import-ownertrust
# OpenWrt Build System (PGP key for 19.07 release builds)
RUN curl 'https://git.openwrt.org/?p=keyring.git;a=blob_plain;f=gpg/2074BE7A.asc' | gpg --import \
&& gpg --fingerprint --with-colons '<pgpsign-19.07@openwrt.org>' | grep '^fpr:::::::::D9C6901F45C9B86858687DFF28A39BC32074BE7A:$' \
&& echo 'D9C6901F45C9B86858687DFF28A39BC32074BE7A:6:' | gpg --import-ownertrust
# untrusted comment: Public usign key for unattended snapshot builds
RUN curl 'https://git.openwrt.org/?p=keyring.git;a=blob_plain;f=usign/b5043e70f9a75cde' --create-dirs -o /home/build/usign/b5043e70f9a75cde \
&& echo 'd7ac10f9ed1b38033855f3d27c9327d558444fca804c685b17d9dcfb0648228f */home/build/usign/b5043e70f9a75cde' | sha256sum --check
# untrusted comment: Public usign key for 19.07 release builds
RUN curl 'https://git.openwrt.org/?p=keyring.git;a=blob_plain;f=usign/f94b9dd6febac963' --create-dirs -o /home/build/usign/f94b9dd6febac963 \
&& echo 'b1d09457cfbc36fccfe18382d65c54a2ade3e7fd3902da490a53aa517b512755 */home/build/usign/f94b9dd6febac963' | sha256sum --check

6
.circleci/README Normal file
View file

@ -0,0 +1,6 @@
# Build/update the docker image
docker pull debian:9
docker build --rm -t docker.io/openwrtorg/packages-cci:latest .
docker tag <IMAGE ID> docker.io/openwrtorg/packages-cci:<VERSION-TAG>
docker push docker.io/openwrtorg/packages-cci

183
.circleci/config.yml Normal file
View file

@ -0,0 +1,183 @@
version: 2.0
jobs:
build:
docker:
- image: docker.io/openwrtorg/packages-cci:v1.0.5
environment:
- SDK_HOST: "downloads.openwrt.org"
- SDK_PATH: "snapshots/targets/ath79/generic"
- SDK_FILE: "openwrt-sdk-ath79-generic_*.Linux-x86_64.tar.xz"
- BRANCH: "master"
steps:
- checkout:
path: ~/openwrt_telephony
- run:
name: Check changes / verify commits
working_directory: ~/openwrt_telephony
command: |
cat >> $BASH_ENV <<EOF
echo_red() { printf "\033[1;31m\$*\033[m\n"; }
echo_green() { printf "\033[1;32m\$*\033[m\n"; }
echo_blue() { printf "\033[1;34m\$*\033[m\n"; }
EOF
source $BASH_ENV
RET=0
for commit in $(git rev-list HEAD ^origin/$BRANCH); do
echo_blue "=== Checking commit '$commit'"
if git show --format='%P' -s $commit | grep -qF ' '; then
echo_red "Pull request should not include merge commits"
RET=1
fi
author="$(git show -s --format=%aN $commit)"
if echo $author | grep -q '\S\+\s\+\S\+'; then
echo_green "Author name ($author) seems ok"
else
echo_red "Author name ($author) need to be your real name 'firstname lastname'"
RET=1
fi
subject="$(git show -s --format=%s $commit)"
if echo "$subject" | grep -q -e '^[0-9A-Za-z,.+/_-]\+: ' -e '^Revert '; then
echo_green "Commit subject line seems ok ($subject)"
else
echo_red "Commit subject line MUST start with '<package name>: ' ($subject)"
RET=1
fi
body="$(git show -s --format=%b $commit)"
sob="$(git show -s --format='Signed-off-by: %aN <%aE>' $commit)"
if echo "$body" | grep -qF "$sob"; then
echo_green "Signed-off-by match author"
else
echo_red "Signed-off-by is missing or doesn't match author (should be '$sob')"
RET=1
fi
done
exit $RET
- run:
name: Download the SDK
working_directory: ~/sdk
command: |
curl "https://$SDK_HOST/$SDK_PATH/sha256sums" -sS -o sha256sums
curl "https://$SDK_HOST/$SDK_PATH/sha256sums.asc" -fs -o sha256sums.asc || true
curl "https://$SDK_HOST/$SDK_PATH/sha256sums.sig" -fs -o sha256sums.sig || true
if [ ! -f sha256sums.asc ] && [ ! -f sha256sums.sig ]; then
echo_red "Missing sha256sums signature files"
exit 1
fi
[ ! -f sha256sums.asc ] || gpg --with-fingerprint --verify sha256sums.asc sha256sums
if [ -f sha256sums.sig ]; then
VERIFIED=
for KEY in ~/usign/*; do
echo "Trying $KEY..."
if signify-openbsd -V -q -p "$KEY" -x sha256sums.sig -m sha256sums; then
echo "...verified"
VERIFIED=1
break
fi
done
if [ -z "$VERIFIED" ]; then
echo_red "Could not verify usign signature"
exit 1
fi
fi
rsync -av "$SDK_HOST::downloads/$SDK_PATH/$SDK_FILE" .
sha256sum -c --ignore-missing sha256sums
- run:
name: Prepare build_dir
working_directory: ~/build_dir
command: |
tar Jxf ~/sdk/$SDK_FILE --strip=1
touch .config
make prepare-tmpinfo scripts/config/conf
./scripts/config/conf --defconfig=.config Config.in
make prereq
rm .config
cat > feeds.conf <<EOF
src-git base https://github.com/openwrt/openwrt.git;$BRANCH
src-git packages https://github.com/openwrt/packages.git;$BRANCH
src-link telephony $HOME/openwrt_telephony
src-git luci https://github.com/openwrt/luci.git;$BRANCH
EOF
cat feeds.conf
./scripts/feeds update -a > /dev/null
make defconfig > /dev/null
# enable BUILD_LOG
sed -i 's/# CONFIG_BUILD_LOG is not set/CONFIG_BUILD_LOG=y/' .config
- run:
name: Install & download source, check package, compile
working_directory: ~/build_dir
command: |
set +o pipefail
PKGS=$(cd ~/openwrt_telephony; git diff --diff-filter=d --name-only "origin/$BRANCH..." | grep 'Makefile$' | grep -Ev '/files/|/src/' | awk -F/ '{ print $(NF-1) }')
if [ -z "$PKGS" ] ; then
echo_blue "WARNING: No new or modified packages found!"
exit 0
fi
echo_blue "=== Found new/modified packages: $PKGS"
for PKG in $PKGS ; do
echo_blue "===+ Install: $PKG"
./scripts/feeds install "$PKG"
echo_blue "===+ Download: $PKG"
make "package/$PKG/download" V=s
echo_blue "===+ Check package: $PKG"
make "package/$PKG/check" V=s 2>&1 | tee logtmp
RET=${PIPESTATUS[0]}
if [ $RET -ne 0 ]; then
echo_red "=> Package check failed: $RET)"
exit $RET
fi
badhash_msg="HASH does not match "
badhash_msg+="|HASH uses deprecated hash,"
badhash_msg+="|HASH is missing,"
if grep -qE "$badhash_msg" logtmp; then
echo_red "=> Package HASH check failed"
exit 1
fi
echo_green "=> Package check OK"
done
make \
-f .config \
-f tmp/.packagedeps \
-f <(echo '$(info $(sort $(package-y) $(package-m)))'; echo -en 'a:\n\t@:') \
| tr ' ' '\n' >enabled-package-subdirs.txt
for PKG in $PKGS ; do
if ! grep -m1 -qE "(^|/)$PKG$" enabled-package-subdirs.txt; then
echo_red "===+ Building: $PKG skipped. It cannot be enabled with $SDK_FILE"
continue
fi
echo_blue "===+ Building: $PKG"
make "package/$PKG/compile" -j3 V=s || {
RET=$?
echo_red "===+ Building: $PKG failed, rebuilding with -j1 for human readable error log"
make "package/$PKG/compile" -j1 V=s; exit $RET
}
done
- store_artifacts:
path: ~/build_dir/logs
- store_artifacts:
path: ~/build_dir/bin
workflows:
version: 2
buildpr:
jobs:
- build:
filters:
branches:
ignore: master

View file

@ -1,16 +1,20 @@
Please make sure that the issue subject starts with `<package-name>: `
Please make sure that the issue subject starts with `<package-name>: ` so that it's easily identifiable.
Also make sure that the package is maintained in this repository and not in base which should be submitted at https://bugs.openwrt.org or in the LuCI repository which should be submitted at https://github.com/openwrt/luci/issues.
This repo here is ONLY for packages maintained in this repo. For base packages residing in the same repo as the build system and maintained by core devs, please consider opening tickets there for more timely responses
Issues related to releases below 18.06 and forks are not supported or maintained and will be closed.
- OpenWrt: https://dev.openwrt.org/newticket
- LEDE: https://bugs.lede-project.org/
- Most LuCI packages: https://github.com/openwrt/luci/issues
# Issue template (remove lines from top till here)
Thanks for your contribution
Please remove this text (before ---) and fill the following template
-------------------------------
Maintainer: @\<github-user> (find it by checking history of the package Makefile)
Environment: (put here arch, model, OpenWrt version)
Maintainer: @<github-user> (find it by checking history of the package Makefile)
Environment: (put here arch, model, OpenWRT/LEDE version)
Description:
```
Format code blocks by wrapping them with pairs of ```
Formating code blocks by wrapping them with pairs of ```
```

View file

@ -1,5 +1,16 @@
Maintainer: me / @\<github-user> (find it by checking history of the package Makefile)
Compile tested: (put here arch, model, OpenWrt version)
Run tested: (put here arch, model, OpenWrt version, tests done)
Please double check that your commits:
- all start with "<package name>: "
- all contain signed-off-by
- are linked to your github account (you see your logo in front of them)
Please also read https://github.com/openwrt/packages/blob/master/CONTRIBUTING.md
Thanks for your contribution
Please remove this text (before ---) and fill the following template
-------------------------------
Maintainer: me / @<github-user>
Compile tested: (put here arch, model, OpenWRT/LEDE version)
Run tested: (put here arch, model, OpenWRT/LEDE version, tests done)
Description:

View file

@ -1,6 +0,0 @@
ARG ARCH=x86-64
FROM openwrt/rootfs:$ARCH
ADD entrypoint.sh /entrypoint.sh
CMD ["/entrypoint.sh"]

View file

@ -1,91 +0,0 @@
name: Check autorelease deprecation
on:
pull_request_target:
types: [opened, synchronize, converted_to_draft, ready_for_review, edited]
jobs:
build:
name: Check autorelease deprecation
runs-on: ubuntu-latest
strategy:
fail-fast: false
permissions:
pull-requests: write
steps:
- uses: actions/checkout@v3
with:
ref: ${{ github.event.pull_request.head.sha }}
fetch-depth: 0
- name: Determine branch name
run: |
BRANCH="${GITHUB_BASE_REF#refs/heads/}"
echo "Building for $BRANCH"
echo "BRANCH=$BRANCH" >> $GITHUB_ENV
- name: Determine changed packages
run: |
RET=0
# only detect packages with changes
PKG_ROOTS=$(find . -name Makefile | \
grep -v ".*/src/Makefile" | \
sed -e 's@./\(.*\)/Makefile@\1/@')
CHANGES=$(git diff --diff-filter=d --name-only origin/$BRANCH...)
for ROOT in $PKG_ROOTS; do
for CHANGE in $CHANGES; do
if [[ "$CHANGE" == "$ROOT"* ]]; then
if grep -q '$(AUTORELEASE)' "$ROOT/Makefile"; then
CONTAINS_AUTORELEASE+="$ROOT"
fi
break
fi
done
done
if [ -n "$CONTAINS_AUTORELEASE" ]; then
RET=1
cat > "$GITHUB_WORKSPACE/pr_comment.md" << EOF
Please do no longer set *PKG_RELEASE* to *AUTORELEASE* as the
feature is deprecated. Please use an integer instead. Below is a
list of affected packages including correct *PKG_RELEASE*:
EOF
fi
for ROOT in $CONTAINS_AUTORELEASE; do
echo -n " - ${ROOT}Makefile: PKG_RELEASE:=" >> "$GITHUB_WORKSPACE/pr_comment.md"
last_bump="$(git log --pretty=format:'%h %s' "$ROOT" |
grep --max-count=1 -e ': [uU]pdate to ' -e ': [bB]ump to ' |
cut -f 1 -d ' ')"
if [ -n "$last_bump" ]; then
echo -n $(($(git rev-list --count "$last_bump..HEAD" "$ROOT") + 2)) >> "$GITHUB_WORKSPACE/pr_comment.md"
else
echo -n $(($(git rev-list --count HEAD "$ROOT") + 2)) >> "$GITHUB_WORKSPACE/pr_comment.md"
fi
echo >> "$GITHUB_WORKSPACE/pr_comment.md"
done
exit $RET
- name: Find Comment
uses: peter-evans/find-comment@v2
if: ${{ failure() }}
id: fc
with:
issue-number: ${{ github.event.pull_request.number }}
comment-author: 'github-actions[bot]'
- name: Create or update comment
uses: peter-evans/create-or-update-comment@v2
if: ${{ failure() }}
with:
comment-id: ${{ steps.fc.outputs.comment-id }}
issue-number: ${{ github.event.pull_request.number }}
body-file: 'pr_comment.md'
edit-mode: replace

View file

@ -1,26 +0,0 @@
#!/bin/sh
color_out() {
printf "\e[0;$1m$PKG_NAME: %s\e[0;0m\n" "$2"
}
success() {
color_out 32 "$1"
}
info() {
color_out 36 "$1"
}
err() {
color_out 31 "$1"
}
warn() {
color_out 33 "$1"
}
err_die() {
err "$1"
exit 1
}

View file

@ -1,43 +0,0 @@
#!/bin/sh
# not enabling `errtrace` and `pipefail` since those are bash specific
set -o errexit # failing commands causes script to fail
set -o nounset # undefined variables causes script to fail
mkdir -p /var/lock/
opkg update
[ -n "${CI_HELPER:=''}" ] || CI_HELPER="/ci/.github/workflows/ci_helpers.sh"
for PKG in /ci/*.ipk; do
tar -xzOf "$PKG" ./control.tar.gz | tar xzf - ./control
# package name including variant
PKG_NAME=$(sed -ne 's#^Package: \(.*\)$#\1#p' ./control)
# package version without release
PKG_VERSION=$(sed -ne 's#^Version: \(.*\)-[0-9]*$#\1#p' ./control)
# package source contianing test.sh script
PKG_SOURCE=$(sed -ne 's#^Source: .*/\(.*\)$#\1#p' ./control)
echo "Testing package $PKG_NAME in version $PKG_VERSION from $PKG_SOURCE"
opkg install "$PKG"
export PKG_NAME PKG_VERSION CI_HELPER
TEST_SCRIPT=$(find /ci/ -name "$PKG_SOURCE" -type d)/test.sh
if [ -f "$TEST_SCRIPT" ]; then
echo "Use package specific test.sh"
if sh "$TEST_SCRIPT" "$PKG_NAME" "$PKG_VERSION"; then
echo "Test successful"
else
echo "Test failed"
exit 1
fi
else
echo "No test.sh script available"
fi
opkg remove "$PKG_NAME" --force-removal-of-dependent-packages --force-remove
done

View file

@ -1,63 +0,0 @@
name: Test Formalities
on:
pull_request:
jobs:
build:
name: Test Formalities
runs-on: ubuntu-latest
strategy:
fail-fast: false
steps:
- uses: actions/checkout@v3
with:
ref: ${{ github.event.pull_request.head.sha }}
fetch-depth: 0
- name: Determine branch name
run: |
BRANCH="${GITHUB_BASE_REF#refs/heads/}"
echo "Building for $BRANCH"
echo "BRANCH=$BRANCH" >> $GITHUB_ENV
- name: Test formalities
run: |
source .github/workflows/ci_helpers.sh
RET=0
for commit in $(git rev-list HEAD ^origin/$BRANCH); do
info "=== Checking commit '$commit'"
if git show --format='%P' -s $commit | grep -qF ' '; then
err "Pull request should not include merge commits"
RET=1
fi
author="$(git show -s --format=%aN $commit)"
if echo $author | grep -q '\S\+\s\+\S\+'; then
success "Author name ($author) seems ok"
else
err "Author name ($author) need to be your real name 'firstname lastname'"
RET=1
fi
subject="$(git show -s --format=%s $commit)"
if echo "$subject" | grep -q -e '^[0-9A-Za-z,+/_-]\+: ' -e '^Revert '; then
success "Commit subject line seems ok ($subject)"
else
err "Commit subject line MUST start with '<package name>: ' ($subject)"
RET=1
fi
body="$(git show -s --format=%b $commit)"
sob="$(git show -s --format='Signed-off-by: %aN <%aE>' $commit)"
if echo "$body" | grep -qF "$sob"; then
success "Signed-off-by match author"
else
err "Signed-off-by is missing or doesn't match author (should be '$sob')"
RET=1
fi
done
exit $RET

View file

@ -1,164 +0,0 @@
name: Test Build
on:
pull_request:
jobs:
build:
name: Test ${{ matrix.arch }}
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
include:
- arch: arm_cortex-a9_vfpv3-d16
target: mvebu-cortexa9
runtime_test: false
- arch: mips_24kc
target: ath79-generic
runtime_test: false
- arch: mipsel_24kc
target: mt7621
runtime_test: false
- arch: powerpc_464fp
target: apm821xx-nand
runtime_test: false
- arch: powerpc_8548
target: mpc85xx-p1010
runtime_test: false
- arch: aarch64_cortex-a53
target: mvebu-cortexa53
runtime_test: true
- arch: arm_cortex-a15_neon-vfpv4
target: armvirt-32
runtime_test: true
- arch: i386_pentium-mmx
target: x86-geode
runtime_test: true
- arch: x86_64
target: x86-64
runtime_test: true
steps:
- uses: actions/checkout@v3
with:
fetch-depth: 0
- name: Determine branch name
run: |
BRANCH="${GITHUB_BASE_REF#refs/heads/}"
echo "Building for $BRANCH"
echo "BRANCH=$BRANCH" >> $GITHUB_ENV
- name: Determine changed packages
run: |
# only detect packages with changes
PKG_ROOTS=$(find . -name Makefile | \
grep -v ".*/src/Makefile" | \
sed -e 's@./\(.*\)/Makefile@\1/@')
CHANGES=$(git diff --diff-filter=d --name-only origin/$BRANCH...)
for ROOT in $PKG_ROOTS; do
for CHANGE in $CHANGES; do
if [[ "$CHANGE" == "$ROOT"* ]]; then
PACKAGES+=$(echo "$ROOT" | sed -e 's@.*/\(.*\)/@\1 @')
break
fi
done
done
# fallback to test packages if nothing explicitly changes this is
# should run if other mechanics in packages.git changed
PACKAGES="${PACKAGES:-vim attendedsysupgrade-common bmon}"
echo "Building $PACKAGES"
echo "PACKAGES=$PACKAGES" >> $GITHUB_ENV
- name: Build
uses: openwrt/gh-action-sdk@v5
env:
ARCH: ${{ matrix.arch }}-${{ env.BRANCH }}
FEEDNAME: packages_ci
- name: Move created packages to project dir
run: cp bin/packages/${{ matrix.arch }}/packages_ci/*.ipk . || true
- name: Collect metadata
run: |
MERGE_ID=$(git rev-parse --short HEAD)
echo "MERGE_ID=$MERGE_ID" >> $GITHUB_ENV
echo "BASE_ID=$(git rev-parse --short HEAD^1)" >> $GITHUB_ENV
echo "HEAD_ID=$(git rev-parse --short HEAD^2)" >> $GITHUB_ENV
PRNUMBER=${GITHUB_REF_NAME%/merge}
echo "PRNUMBER=$PRNUMBER" >> $GITHUB_ENV
echo "ARCHIVE_NAME=${{matrix.arch}}-PR$PRNUMBER-$MERGE_ID" >> $GITHUB_ENV
- name: Generate metadata
run: |
cat << _EOF_ > PKG-INFO
Metadata-Version: 2.1
Name: ${{env.ARCHIVE_NAME}}
Version: $BRANCH
Author: $GITHUB_ACTOR
Home-page: $GITHUB_SERVER_URL/$GITHUB_REPOSITORY/pull/$PRNUMBER
Download-URL: $GITHUB_SERVER_URL/$GITHUB_REPOSITORY/actions/runs/$GITHUB_RUN_ID
Summary: $PACKAGES
Platform: ${{ matrix.arch }}
Packages for OpenWrt $BRANCH running on ${{matrix.arch}}, built from PR $PRNUMBER
at commit $HEAD_ID, against $BRANCH at commit $BASE_ID, with merge SHA $MERGE_ID.
Modified packages:
_EOF_
for p in $PACKAGES
do
echo " "$p >> PKG-INFO
done
echo >> PKG-INFO
echo Full file listing: >> PKG-INFO
ls -al *.ipk >> PKG-INFO || true
cat PKG-INFO
- name: Store packages
uses: actions/upload-artifact@v3
with:
name: ${{env.ARCHIVE_NAME}}-packages
path: |
*.ipk
PKG-INFO
- name: Store logs
uses: actions/upload-artifact@v3
with:
name: ${{env.ARCHIVE_NAME}}-logs
path: |
logs/
PKG-INFO
- name: Remove logs
run: sudo rm -rf logs/ || true
- name: Register QEMU
if: ${{ matrix.runtime_test }}
run: |
sudo docker run --rm --privileged aptman/qus -s -- -p
- name: Build Docker container
if: ${{ matrix.runtime_test }}
run: |
docker build -t test-container --build-arg ARCH .github/workflows/
env:
ARCH: ${{ matrix.arch }}-${{ env.BRANCH }}
- name: Test via Docker container
if: ${{ matrix.runtime_test }}
run: |
docker run --rm -v $GITHUB_WORKSPACE:/ci test-container

View file

@ -8,19 +8,18 @@
include $(TOPDIR)/rules.mk
PKG_NAME:=bcg729
PKG_VERSION:=1.1.1
PKG_RELEASE:=1
PKG_VERSION:=1.0.4
PKG_RELEASE:=4
PKG_SOURCE_URL_FILE:=$(PKG_VERSION).tar.gz
PKG_SOURCE:=$(PKG_NAME)-$(PKG_SOURCE_URL_FILE)
PKG_SOURCE_URL:=https://github.com/BelledonneCommunications/$(PKG_NAME)/archive
PKG_HASH:=68599a850535d1b182932b3f86558ac8a76d4b899a548183b062956c5fdc916d
PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.gz
PKG_SOURCE_URL:=https://www.linphone.org/releases/sources/bcg729
PKG_HASH:=1a0fbf1ff91470037e83fa67976f940ebb601e4cc525859c754f4e7ffc24c307
PKG_BUILD_DIR:=$(BUILD_DIR)/$(PKG_NAME)-$(PKG_VERSION)
CMAKE_INSTALL:=1
PKG_LICENSE:=GPL-3.0-or-later
PKG_LICENSE_FILES:=LICENSE.txt
PKG_LICENSE:=GPL-2.0+
PKG_LICENSE_FILES:=COPYING
PKG_MAINTAINER:=Alex Samorukov <samm@os2.kiev.ua>
include $(INCLUDE_DIR)/package.mk

View file

@ -0,0 +1,30 @@
commit a5907daf1b111e4ad7aab4f558f57e2af1e37e55
Author: Peter Wu <peter@lekensteyn.nl>
Date: Mon Feb 4 13:08:10 2019 +0100
CMake: install pkg-config files for parity with autotools
diff --git a/CMakeLists.txt b/CMakeLists.txt
index a271876..e1496a7 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -92,6 +92,19 @@ configure_file(Bcg729Config.cmake.in
@ONLY
)
+set(prefix "${CMAKE_INSTALL_PREFIX}")
+set(exec_prefix "\${prefix}")
+set(includedir "\${prefix}/include")
+set(libdir "\${exec_prefix}/${CMAKE_INSTALL_LIBDIR}")
+configure_file(libbcg729.pc.in
+ "${CMAKE_CURRENT_BINARY_DIR}/libbcg729.pc"
+ @ONLY
+)
+install(FILES
+ "${CMAKE_CURRENT_BINARY_DIR}/libbcg729.pc"
+ DESTINATION ${CMAKE_INSTALL_LIBDIR}/pkgconfig
+)
+
set(CONFIG_PACKAGE_LOCATION "${CMAKE_INSTALL_DATADIR}/Bcg729/cmake")
install(EXPORT Bcg729Targets
FILE Bcg729Targets.cmake

View file

@ -9,22 +9,17 @@ include $(TOPDIR)/rules.mk
include $(INCLUDE_DIR)/kernel.mk
PKG_NAME:=dahdi-linux
PKG_RELEASE:=1
PKG_VERSION:=3.1.0
PKG_RELEASE:=4
PKG_SOURCE_PROTO:=git
PKG_SOURCE_URL:=https://github.com/asterisk/dahdi-linux.git
PKG_SOURCE_DATE=2023-09-21
PKG_SOURCE_VERSION:=1bb9088f2baff8c4e3fec536044cc48072cf9905
PKG_MIRROR_HASH:=b32eb405d64c981f64922840f616cf362636ccc93506986c0b92bd4dcca5ab30
PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.gz
PKG_SOURCE_URL:=https://downloads.asterisk.org/pub/telephony/dahdi-linux/releases
PKG_HASH:=db5b758437d066a7edad34b54313f08a4ccdde28373492986b72c798e8561b4d
PKG_LICENSE:=GPL-2.0
PKG_LICENSE_FILES:=LICENSE
PKG_MAINTAINER:=Vittorio Gambaletta <openwrt@vittgam.net>
# With below variable set, $(PKG_SYMVERS_DIR)/dahdi-linux.symvers gets
# generated from drivers/dahdi/Module.symvers.
PKG_EXTMOD_SUBDIRS:=drivers/dahdi
include $(INCLUDE_DIR)/package.mk
define KernelPackage/dahdi
@ -91,8 +86,10 @@ define Build/Prepare
endef
define Build/Compile
$(MAKE) $(PKG_JOBS) -C $(PKG_BUILD_DIR) \
$(KERNEL_MAKE_FLAGS) \
$(MAKE) -C $(PKG_BUILD_DIR) \
ARCH="$(LINUX_KARCH)" \
$(TARGET_CONFIGURE_OPTS) \
CROSS_COMPILE="$(TARGET_CROSS)" \
KSRC="$(LINUX_DIR)"
endef

View file

@ -1,6 +1,6 @@
--- a/drivers/dahdi/Kbuild
+++ b/drivers/dahdi/Kbuild
@@ -64,9 +64,8 @@ obj-m += $(DAHDI_MODULES_EXTRA)
@@ -54,9 +54,8 @@ obj-m += $(DAHDI_MODULES_EXTRA)
# If you want to build OSLEC, include the code in the standard location:
# drivers/staging/echo . The DAHDI OSLEC echo canceller will be built as
# well:

View file

@ -6,11 +6,11 @@
obj-$(DAHDI_BUILD_ALL)$(CONFIG_DAHDI_WCTE13XP) += wcte13xp.o
+obj-$(DAHDI_BUILD_ALL)$(CONFIG_DAHDI_HFCS) += hfcs/
ifndef HOTPLUG_FIRMWARE
ifneq (,$(filter y m,$(CONFIG_FW_LOADER)))
wcte13xp-objs := wcte13xp-base.o wcxb_spi.o wcxb.o wcxb_flash.o
CFLAGS_wcte13xp-base.o += -I$(src)/oct612x -I$(src)/oct612x/include -I$(src)/oct612x/octdeviceapi -I$(src)/oct612x/octdeviceapi/oct6100api
--- a/drivers/dahdi/Kconfig
+++ b/drivers/dahdi/Kconfig
@@ -235,4 +235,14 @@ config DAHDI_DYNAMIC_LOC
@@ -223,4 +223,14 @@ config DAHDI_DYNAMIC_LOC
If unsure, say Y.

View file

@ -0,0 +1,13 @@
--- a/include/dahdi/kernel.h
+++ b/include/dahdi/kernel.h
@@ -59,8 +59,10 @@
#include <linux/poll.h>
#ifdef CONFIG_PCI
+#if LINUX_VERSION_CODE < KERNEL_VERSION(5,4,0)
#include <linux/pci-aspm.h>
#endif
+#endif
#if LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 29)
#define HAVE_NET_DEVICE_OPS

View file

@ -8,7 +8,7 @@
#include <linux/proc_fs.h>
#include <linux/seq_file.h>
#include <linux/slab.h>
@@ -1768,11 +1769,13 @@ out:
@@ -1754,11 +1755,13 @@ out:
static void xbus_fill_proc_queue(struct seq_file *sfile, struct xframe_queue *q)
{
@ -127,7 +127,7 @@
#if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,18)
#include <asm/uaccess.h>
#else
@@ -891,7 +892,7 @@ static void xpp_send_callback(struct urb
@@ -886,7 +887,7 @@ static void xpp_send_callback(struct urb
usec = 0; /* System clock jumped */
if (usec > xusb->max_tx_delay)
xusb->max_tx_delay = usec;

View file

@ -0,0 +1,478 @@
From 34b9c77c9ab2794d4e912461e4c1080c4b1f6184 Mon Sep 17 00:00:00 2001
From: Shaun Ruffell <sruffell@sruffell.net>
Date: Sun, 23 Feb 2020 19:39:24 -0600
Subject: [PATCH 05/12] Use proc_ops on kernels >= 5.6
In commit (d56c0d45f0e27 "proc: decouple proc from VFS with "struct proc_ops"")
[1], proc_create_data no longer takes a file_operations structure, but instead
takes a struct proc_ops in order to conserve memory in the kernel.
This change is necessary for DAHDI to work with kernels >= 5.6
[1] https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/commit/?id=d56c0d45f0e27f814e87a1676b6bd
Signed-off-by: Shaun Ruffell <sruffell@sruffell.net>
---
drivers/dahdi/dahdi-base.c | 9 +++++
drivers/dahdi/dahdi_dynamic_ethmf.c | 18 +++++++--
drivers/dahdi/xpp/card_bri.c | 23 ++++++++---
drivers/dahdi/xpp/card_fxo.c | 25 +++++++++---
drivers/dahdi/xpp/card_fxs.c | 35 +++++++++++++---
drivers/dahdi/xpp/xbus-core.c | 62 ++++++++++++++++++++++++-----
drivers/dahdi/xpp/xpp_dahdi.c | 23 ++++++++---
drivers/dahdi/xpp/xpp_usb.c | 26 +++++++++---
include/dahdi/kernel.h | 11 +++--
9 files changed, 187 insertions(+), 45 deletions(-)
--- a/drivers/dahdi/dahdi-base.c
+++ b/drivers/dahdi/dahdi-base.c
@@ -1015,6 +1015,14 @@ static int dahdi_proc_open(struct inode
return single_open(file, dahdi_seq_show, PDE_DATA(inode));
}
+#ifdef DAHDI_HAVE_PROC_OPS
+static const struct proc_ops dahdi_proc_ops = {
+ .proc_open = dahdi_proc_open,
+ .proc_read = seq_read,
+ .proc_lseek = seq_lseek,
+ .proc_release = single_release,
+};
+#else
static const struct file_operations dahdi_proc_ops = {
.owner = THIS_MODULE,
.open = dahdi_proc_open,
@@ -1022,6 +1030,7 @@ static const struct file_operations dahd
.llseek = seq_lseek,
.release = single_release,
};
+#endif /* DAHDI_HAVE_PROC_OPS */
#endif
--- a/drivers/dahdi/dahdi_dynamic_ethmf.c
+++ b/drivers/dahdi/dahdi_dynamic_ethmf.c
@@ -733,12 +733,22 @@ static int ztdethmf_proc_open(struct ino
return single_open(file, ztdethmf_proc_show, NULL);
}
+#ifdef DAHDI_HAVE_PROC_OPS
+static const struct proc_ops ztdethmf_proc_fops = {
+ .proc_open = ztdethmf_proc_open,
+ .proc_read = seq_read,
+ .proc_lseek = seq_lseek,
+ .proc_release = seq_release,
+};
+#else
static const struct file_operations ztdethmf_proc_fops = {
- .open = ztdethmf_proc_open,
- .read = seq_read,
- .llseek = seq_lseek,
- .release = seq_release,
+ .owner = THIS_MODULE,
+ .open = ztdethmf_proc_open,
+ .read = seq_read,
+ .llseek = seq_lseek,
+ .release = seq_release,
};
+#endif /* DAHDI_HAVE_PROC_OPS */
#endif
static int __init ztdethmf_init(void)
--- a/drivers/dahdi/xpp/card_bri.c
+++ b/drivers/dahdi/xpp/card_bri.c
@@ -153,8 +153,12 @@ static int write_state_register(xpd_t *x
static bool bri_packet_is_valid(xpacket_t *pack);
static void bri_packet_dump(const char *msg, xpacket_t *pack);
#ifdef CONFIG_PROC_FS
+#ifdef DAHDI_HAVE_PROC_OPS
+static const struct proc_ops proc_bri_info_ops;
+#else
static const struct file_operations proc_bri_info_ops;
#endif
+#endif
static int bri_spanconfig(struct file *file, struct dahdi_span *span,
struct dahdi_lineconfig *lc);
static int bri_chanconfig(struct file *file, struct dahdi_chan *chan,
@@ -1740,13 +1744,22 @@ static int proc_bri_info_open(struct ino
return single_open(file, proc_bri_info_show, PDE_DATA(inode));
}
+#ifdef DAHDI_HAVE_PROC_OPS
+static const struct proc_ops proc_bri_info_ops = {
+ .proc_open = proc_bri_info_open,
+ .proc_read = seq_read,
+ .proc_lseek = seq_lseek,
+ .proc_release = single_release,
+};
+#else
static const struct file_operations proc_bri_info_ops = {
- .owner = THIS_MODULE,
- .open = proc_bri_info_open,
- .read = seq_read,
- .llseek = seq_lseek,
- .release = single_release,
+ .owner = THIS_MODULE,
+ .open = proc_bri_info_open,
+ .read = seq_read,
+ .llseek = seq_lseek,
+ .release = single_release,
};
+#endif /* DAHDI_HAVE_PROC_OPS */
#endif
static int bri_xpd_probe(struct device *dev)
--- a/drivers/dahdi/xpp/card_fxo.c
+++ b/drivers/dahdi/xpp/card_fxo.c
@@ -107,9 +107,13 @@ enum fxo_leds {
static bool fxo_packet_is_valid(xpacket_t *pack);
static void fxo_packet_dump(const char *msg, xpacket_t *pack);
#ifdef CONFIG_PROC_FS
+#ifdef DAHDI_HAVE_PROC_OPS
+static const struct proc_ops proc_fxo_info_ops;
+#else
static const struct file_operations proc_fxo_info_ops;
+#endif
#ifdef WITH_METERING
-static const struct file_operations proc_xpd_metering_ops;
+static const struct proc_ops proc_xpd_metering_ops;
#endif
#endif
static void dahdi_report_battery(xpd_t *xpd, lineno_t chan);
@@ -1484,13 +1488,22 @@ static int proc_fxo_info_open(struct ino
return single_open(file, proc_fxo_info_show, PDE_DATA(inode));
}
+#ifdef DAHDI_HAVE_PROC_OPS
+static const struct proc_ops proc_fxo_info_ops = {
+ .proc_open = proc_fxo_info_open,
+ .proc_read = seq_read,
+ .proc_lseek = seq_lseek,
+ .proc_release = single_release,
+};
+#else
static const struct file_operations proc_fxo_info_ops = {
- .owner = THIS_MODULE,
- .open = proc_fxo_info_open,
- .read = seq_read,
- .llseek = seq_lseek,
- .release = single_release,
+ .owner = THIS_MODULE,
+ .open = proc_fxo_info_open,
+ .read = seq_read,
+ .llseek = seq_lseek,
+ .release = single_release,
};
+#endif
#ifdef WITH_METERING
static int proc_xpd_metering_show(struct seq_file *sfile, void *not_used)
--- a/drivers/dahdi/xpp/card_fxs.c
+++ b/drivers/dahdi/xpp/card_fxs.c
@@ -160,11 +160,19 @@ enum neon_state {
static bool fxs_packet_is_valid(xpacket_t *pack);
static void fxs_packet_dump(const char *msg, xpacket_t *pack);
#ifdef CONFIG_PROC_FS
+#ifdef DAHDI_HAVE_PROC_OPS
+static const struct proc_ops proc_fxs_info_ops;
+#else
static const struct file_operations proc_fxs_info_ops;
+#endif
#ifdef WITH_METERING
+#ifdef DAHDI_HAVE_PROC_OPS
+static const struct proc_ops proc_xpd_metering_ops;
+#else
static const struct file_operations proc_xpd_metering_ops;
#endif
#endif
+#endif
static void start_stop_vm_led(xbus_t *xbus, xpd_t *xpd, lineno_t pos);
#define PROC_FXS_INFO_FNAME "fxs_info"
@@ -2115,13 +2123,22 @@ static int proc_fxs_info_open(struct ino
return single_open(file, proc_fxs_info_show, PDE_DATA(inode));
}
+#ifdef DAHDI_HAVE_PROC_OPS
+static const struct proc_ops proc_fxs_info_ops = {
+ .proc_open = proc_fxs_info_open,
+ .proc_read = seq_read,
+ .proc_lseek = seq_lseek,
+ .proc_release = single_release,
+};
+#else
static const struct file_operations proc_fxs_info_ops = {
- .owner = THIS_MODULE,
- .open = proc_fxs_info_open,
- .read = seq_read,
- .llseek = seq_lseek,
- .release = single_release,
+ .owner = THIS_MODULE,
+ .open = proc_fxs_info_open,
+ .read = seq_read,
+ .llseek = seq_lseek,
+ .release = single_release,
};
+#endif
#ifdef WITH_METERING
static ssize_t proc_xpd_metering_write(struct file *file,
@@ -2165,12 +2182,20 @@ static int proc_xpd_metering_open(struct
file->private_data = PDE_DATA(inode);
}
+#ifdef DAHDI_HAVE_PROC_OPS
+static const struct proc_ops proc_xpd_metering_ops = {
+ .proc_open = proc_xpd_metering_open,
+ .proc_write = proc_xpd_metering_write,
+ .proc_release = single_release,
+};
+#else
static const struct file_operations proc_xpd_metering_ops = {
.owner = THIS_MODULE,
.open = proc_xpd_metering_open,
.write = proc_xpd_metering_write,
.release = single_release,
};
+#endif /* DAHDI_HAVE_PROC_OPS */
#endif
#endif
--- a/drivers/dahdi/xpp/xbus-core.c
+++ b/drivers/dahdi/xpp/xbus-core.c
@@ -51,8 +51,15 @@ static const char rcsid[] = "$Id$";
#ifdef PROTOCOL_DEBUG
#ifdef CONFIG_PROC_FS
#define PROC_XBUS_COMMAND "command"
+
+#ifdef DAHDI_HAVE_PROC_OPS
+static const struct proc_ops proc_xbus_command_ops;
+#else
static const struct file_operations proc_xbus_command_ops;
+#endif /* DAHDI_HAVE_PROC_OPS */
+
#endif
+
#endif
/* Command line parameters */
@@ -66,8 +73,15 @@ static DEF_PARM_BOOL(dahdi_autoreg, 0, 0
"Register devices automatically (1) or not (0). UNUSED.");
#ifdef CONFIG_PROC_FS
+
+#ifdef DAHDI_HAVE_PROC_OPS
+static const struct proc_ops xbus_read_proc_ops;
+#else
static const struct file_operations xbus_read_proc_ops;
-#endif
+#endif /* DAHDI_HAVE_PROC_OPS */
+
+#endif /* CONFIG_PROC_FS */
+
static void transport_init(xbus_t *xbus, struct xbus_ops *ops,
ushort max_send_size,
struct device *transport_device, void *priv);
@@ -1831,13 +1845,22 @@ static int xbus_read_proc_open(struct in
return single_open(file, xbus_proc_show, PDE_DATA(inode));
}
+#ifdef DAHDI_HAVE_PROC_OPS
+static const struct proc_ops xbus_read_proc_ops = {
+ .proc_open = xbus_read_proc_open,
+ .proc_read = seq_read,
+ .proc_lseek = seq_lseek,
+ .proc_release = single_release,
+};
+#else
static const struct file_operations xbus_read_proc_ops = {
- .owner = THIS_MODULE,
- .open = xbus_read_proc_open,
- .read = seq_read,
- .llseek = seq_lseek,
- .release = single_release,
+ .owner = THIS_MODULE,
+ .open = xbus_read_proc_open,
+ .read = seq_read,
+ .llseek = seq_lseek,
+ .release = single_release,
};
+#endif /* DAHDI_HAVE_PROC_OPS */
#ifdef PROTOCOL_DEBUG
static ssize_t proc_xbus_command_write(struct file *file,
@@ -1930,11 +1953,19 @@ static int proc_xbus_command_open(struct
return 0;
}
+#ifdef DAHDI_HAVE_PROC_OPS
+static const struct proc_ops proc_xbus_command_ops = {
+ .proc_open = proc_xbus_command_open,
+ .proc_write = proc_xbus_command_write,
+};
+#else
static const struct file_operations proc_xbus_command_ops = {
.owner = THIS_MODULE,
.open = proc_xbus_command_open,
.write = proc_xbus_command_write,
};
+#endif /* DAHDI_HAVE_PROC_OPS */
+
#endif
static int xpp_proc_read_show(struct seq_file *sfile, void *data)
@@ -1964,13 +1995,22 @@ static int xpp_proc_read_open(struct ino
return single_open(file, xpp_proc_read_show, PDE_DATA(inode));
}
+#ifdef DAHDI_HAVE_PROC_OPS
+static const struct proc_ops xpp_proc_read_ops = {
+ .proc_open = xpp_proc_read_open,
+ .proc_read = seq_read,
+ .proc_lseek = seq_lseek,
+ .proc_release = single_release,
+};
+#else
static const struct file_operations xpp_proc_read_ops = {
- .owner = THIS_MODULE,
- .open = xpp_proc_read_open,
- .read = seq_read,
- .llseek = seq_lseek,
- .release = single_release,
+ .owner = THIS_MODULE,
+ .open = xpp_proc_read_open,
+ .read = seq_read,
+ .llseek = seq_lseek,
+ .release = single_release,
};
+#endif /* DAHDI_HAVE_PROC_OPS */
#endif
--- a/drivers/dahdi/xpp/xpp_dahdi.c
+++ b/drivers/dahdi/xpp/xpp_dahdi.c
@@ -103,8 +103,12 @@ int total_registered_spans(void)
}
#ifdef CONFIG_PROC_FS
+#ifdef DAHDI_HAVE_PROC_OPS
+static const struct proc_ops xpd_read_proc_ops;
+#else
static const struct file_operations xpd_read_proc_ops;
#endif
+#endif
/*------------------------- XPD Management -------------------------*/
@@ -392,13 +396,22 @@ static int xpd_read_proc_open(struct ino
return single_open(file, xpd_read_proc_show, PDE_DATA(inode));
}
+#ifdef DAHDI_HAVE_PROC_OPS
+static const struct proc_ops xpd_read_proc_ops = {
+ .proc_open = xpd_read_proc_open,
+ .proc_read = seq_read,
+ .proc_lseek = seq_lseek,
+ .proc_release = single_release,
+};
+#else
static const struct file_operations xpd_read_proc_ops = {
- .owner = THIS_MODULE,
- .open = xpd_read_proc_open,
- .read = seq_read,
- .llseek = seq_lseek,
- .release = single_release,
+ .owner = THIS_MODULE,
+ .open = xpd_read_proc_open,
+ .read = seq_read,
+ .llseek = seq_lseek,
+ .release = single_release,
};
+#endif
#endif
--- a/drivers/dahdi/xpp/xpp_usb.c
+++ b/drivers/dahdi/xpp/xpp_usb.c
@@ -232,9 +232,14 @@ static void xpp_receive_callback(struct
static int xusb_probe(struct usb_interface *interface,
const struct usb_device_id *id);
static void xusb_disconnect(struct usb_interface *interface);
-#ifdef CONFIG_PROC_FS
+
+#ifdef CONFIG_PROC_FS
+#ifdef DAHDI_HAVE_PROC_OPS
+static const struct proc_ops xusb_read_proc_ops;
+#else
static const struct file_operations xusb_read_proc_ops;
#endif
+#endif
/*------------------------------------------------------------------*/
@@ -1113,13 +1118,22 @@ static int xusb_read_proc_open(struct in
return single_open(file, xusb_read_proc_show, PDE_DATA(inode));
}
+#ifdef DAHDI_HAVE_PROC_OPS
+static const struct proc_ops xusb_read_proc_ops = {
+ .proc_open = xusb_read_proc_open,
+ .proc_read = seq_read,
+ .proc_lseek = seq_lseek,
+ .proc_release = single_release,
+};
+#else
static const struct file_operations xusb_read_proc_ops = {
- .owner = THIS_MODULE,
- .open = xusb_read_proc_open,
- .read = seq_read,
- .llseek = seq_lseek,
- .release = single_release,
+ .owner = THIS_MODULE,
+ .open = xusb_read_proc_open,
+ .read = seq_read,
+ .llseek = seq_lseek,
+ .release = single_release,
};
+#endif
#endif
--- a/include/dahdi/kernel.h
+++ b/include/dahdi/kernel.h
@@ -68,6 +68,8 @@
#define HAVE_NET_DEVICE_OPS
#endif
+#define DAHDI_HAVE_PROC_OPS
+
/* __dev* were removed in 3.8. They still have effect in 2.6.18. */
#ifndef __devinit
# define __devinit
@@ -1375,6 +1377,10 @@ static inline short dahdi_txtone_nextsam
/*! Maximum audio mask */
#define DAHDI_FORMAT_AUDIO_MASK ((1 << 16) - 1)
+#if LINUX_VERSION_CODE < KERNEL_VERSION(5, 6, 0)
+
+#undef DAHDI_HAVE_PROC_OPS
+
#if LINUX_VERSION_CODE < KERNEL_VERSION(4, 15, 0)
#ifndef TIMER_DATA_TYPE
@@ -1485,14 +1491,13 @@ static inline void *PDE_DATA(const struc
#endif /* 4.10.0 */
#endif /* 4.11.0 */
#endif /* 4.13.0 */
-#else /* >= 4.15.0 */
+#endif /* 4.15.0 */
+#endif /* 5.6 */
#ifndef TIMER_DATA_TYPE
#define TIMER_DATA_TYPE struct timer_list *
#endif
-#endif /* 4.15.0 */
-
#ifndef dahdi_ktime_equal
static inline int dahdi_ktime_equal(const ktime_t cmp1, const ktime_t cmp2)
{

View file

@ -0,0 +1,89 @@
From 4df746fe3ffd6678f36b16c9b0750fa552da92e4 Mon Sep 17 00:00:00 2001
From: Shaun Ruffell <sruffell@sruffell.net>
Date: Mon, 16 Nov 2020 22:01:21 -0600
Subject: [PATCH 09/12] Remove support for 32-bit userspace with 64-bit kernel
I am not aware of anyone who tests in this configuration, and I'm not
sure if it currently works. I'll remove any support for the time being
and can add it back in if someone comes forward needing support for it.
Signed-off-by: Shaun Ruffell <sruffell@sruffell.net>
---
drivers/dahdi/dahdi-base.c | 34 ----------------------------------
1 file changed, 34 deletions(-)
--- a/drivers/dahdi/dahdi-base.c
+++ b/drivers/dahdi/dahdi-base.c
@@ -7019,17 +7019,6 @@ static int dahdi_ioctl(struct inode *ino
}
#endif
-#ifdef HAVE_COMPAT_IOCTL
-static long dahdi_ioctl_compat(struct file *file, unsigned int cmd,
- unsigned long data)
-{
- if (cmd == DAHDI_SFCONFIG)
- return -ENOTTY; /* Not supported yet */
-
- return dahdi_unlocked_ioctl(file, cmd, data);
-}
-#endif
-
/**
* _get_next_channo - Return the next taken channel number from the span list.
* @span: The span with which to start the search.
@@ -10285,9 +10274,6 @@ static const struct file_operations dahd
.release = dahdi_release,
#ifdef HAVE_UNLOCKED_IOCTL
.unlocked_ioctl = dahdi_unlocked_ioctl,
-#ifdef HAVE_COMPAT_IOCTL
- .compat_ioctl = dahdi_ioctl_compat,
-#endif
#else
.ioctl = dahdi_ioctl,
#endif
@@ -10301,9 +10287,6 @@ static const struct file_operations dahd
.release = dahdi_timer_release,
#ifdef HAVE_UNLOCKED_IOCTL
.unlocked_ioctl = dahdi_timer_unlocked_ioctl,
-#ifdef HAVE_COMPAT_IOCTL
- .compat_ioctl = dahdi_timer_unlocked_ioctl,
-#endif
#else
.ioctl = dahdi_timer_ioctl,
#endif
@@ -10377,24 +10360,10 @@ static int nodev_ioctl(struct inode *ino
}
#endif
-#ifdef HAVE_COMPAT_IOCTL
-static long nodev_ioctl_compat(struct file *file, unsigned int cmd,
- unsigned long data)
-{
- if (cmd == DAHDI_SFCONFIG)
- return -ENOTTY; /* Not supported yet */
-
- return nodev_unlocked_ioctl(file, cmd, data);
-}
-#endif
-
static const struct file_operations nodev_fops = {
.owner = THIS_MODULE,
#ifdef HAVE_UNLOCKED_IOCTL
.unlocked_ioctl = nodev_unlocked_ioctl,
-#ifdef HAVE_COMPAT_IOCTL
- .compat_ioctl = nodev_ioctl_compat,
-#endif
#else
.ioctl = nodev_ioctl,
#endif
@@ -10409,9 +10378,6 @@ static const struct file_operations dahd
.release = dahdi_release,
#ifdef HAVE_UNLOCKED_IOCTL
.unlocked_ioctl = dahdi_unlocked_ioctl,
-#ifdef HAVE_COMPAT_IOCTL
- .compat_ioctl = dahdi_ioctl_compat,
-#endif
#else
.ioctl = dahdi_ioctl,
#endif

View file

@ -0,0 +1,148 @@
From 6d4c748e0470efac90e7dc4538ff3c5da51f0169 Mon Sep 17 00:00:00 2001
From: Shaun Ruffell <sruffell@sruffell.net>
Date: Mon, 16 Nov 2020 22:01:22 -0600
Subject: [PATCH 10/12] Remove checks for HAVE_UNLOCKED_IOCTL for kernel >= 5.9
In upstream commit (4e24566a134ea1674 "fs: remove the HAVE_UNLOCKED_IOCTL and
HAVE_COMPAT_IOCTL defines") [1] the kernel removed these defines.
All supported kernels include support for the unlocked_ioctl now, so
DAHDI can also remove these checks.
[1] https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/commit/?id=4e24566a134ea167441a1ffa3d439a27c
Signed-off-by: Shaun Ruffell <sruffell@sruffell.net>
---
drivers/dahdi/dahdi-base.c | 44 ---------------------------------
drivers/dahdi/dahdi_transcode.c | 11 ---------
2 files changed, 55 deletions(-)
--- a/drivers/dahdi/dahdi-base.c
+++ b/drivers/dahdi/dahdi-base.c
@@ -53,10 +53,6 @@
#include <linux/ktime.h>
#include <linux/slab.h>
-#if defined(HAVE_UNLOCKED_IOCTL) && defined(CONFIG_BKL)
-#include <linux/smp_lock.h>
-#endif
-
#include <linux/ppp_defs.h>
#include <asm/atomic.h>
@@ -4069,14 +4065,6 @@ dahdi_timer_unlocked_ioctl(struct file *
return 0;
}
-#ifndef HAVE_UNLOCKED_IOCTL
-static int dahdi_timer_ioctl(struct inode *inode, struct file *file,
- unsigned int cmd, unsigned long data)
-{
- return dahdi_timer_unlocked_ioctl(file, cmd, data);
-}
-#endif
-
static int dahdi_ioctl_getgains(struct file *file, unsigned long data)
{
int res = 0;
@@ -7011,14 +6999,6 @@ exit:
return ret;
}
-#ifndef HAVE_UNLOCKED_IOCTL
-static int dahdi_ioctl(struct inode *inode, struct file *file,
- unsigned int cmd, unsigned long data)
-{
- return dahdi_unlocked_ioctl(file, cmd, data);
-}
-#endif
-
/**
* _get_next_channo - Return the next taken channel number from the span list.
* @span: The span with which to start the search.
@@ -10272,11 +10252,7 @@ static const struct file_operations dahd
.owner = THIS_MODULE,
.open = dahdi_open,
.release = dahdi_release,
-#ifdef HAVE_UNLOCKED_IOCTL
.unlocked_ioctl = dahdi_unlocked_ioctl,
-#else
- .ioctl = dahdi_ioctl,
-#endif
.poll = dahdi_poll,
.read = dahdi_no_read,
.write = dahdi_no_write,
@@ -10285,11 +10261,7 @@ static const struct file_operations dahd
static const struct file_operations dahdi_timer_fops = {
.owner = THIS_MODULE,
.release = dahdi_timer_release,
-#ifdef HAVE_UNLOCKED_IOCTL
.unlocked_ioctl = dahdi_timer_unlocked_ioctl,
-#else
- .ioctl = dahdi_timer_ioctl,
-#endif
.poll = dahdi_timer_poll,
.read = dahdi_no_read,
.write = dahdi_no_write,
@@ -10352,21 +10324,9 @@ nodev_unlocked_ioctl(struct file *file,
return nodev_common("ioctl");
}
-#ifndef HAVE_UNLOCKED_IOCTL
-static int nodev_ioctl(struct inode *inode, struct file *file,
- unsigned int cmd, unsigned long data)
-{
- return nodev_unlocked_ioctl(file, cmd, data);
-}
-#endif
-
static const struct file_operations nodev_fops = {
.owner = THIS_MODULE,
-#ifdef HAVE_UNLOCKED_IOCTL
.unlocked_ioctl = nodev_unlocked_ioctl,
-#else
- .ioctl = nodev_ioctl,
-#endif
.read = nodev_chan_read,
.write = nodev_chan_write,
.poll = nodev_chan_poll,
@@ -10376,11 +10336,7 @@ static const struct file_operations dahd
.owner = THIS_MODULE,
.open = dahdi_open,
.release = dahdi_release,
-#ifdef HAVE_UNLOCKED_IOCTL
.unlocked_ioctl = dahdi_unlocked_ioctl,
-#else
- .ioctl = dahdi_ioctl,
-#endif
.read = dahdi_chan_read,
.write = dahdi_chan_write,
.poll = dahdi_chan_poll,
--- a/drivers/dahdi/dahdi_transcode.c
+++ b/drivers/dahdi/dahdi_transcode.c
@@ -397,13 +397,6 @@ static long dahdi_tc_unlocked_ioctl(stru
};
}
-#ifndef HAVE_UNLOCKED_IOCTL
-static int dahdi_tc_ioctl(struct inode *inode, struct file *file, unsigned int cmd, unsigned long data)
-{
- return (int)dahdi_tc_unlocked_ioctl(file, cmd, data);
-}
-#endif
-
static unsigned int dahdi_tc_poll(struct file *file, struct poll_table_struct *wait_table)
{
int ret;
@@ -427,11 +420,7 @@ static struct file_operations __dahdi_tr
.owner = THIS_MODULE,
.open = dahdi_tc_open,
.release = dahdi_tc_release,
-#ifdef HAVE_UNLOCKED_IOCTL
.unlocked_ioctl = dahdi_tc_unlocked_ioctl,
-#else
- .ioctl = dahdi_tc_ioctl,
-#endif
.read = dahdi_tc_read,
.write = dahdi_tc_write,
.poll = dahdi_tc_poll,

View file

@ -1,131 +0,0 @@
From f9bc391e1cd830c830b3b4fb5fd46a59b41de373 Mon Sep 17 00:00:00 2001
From: Christian Marangi <ansuelsmth@gmail.com>
Date: Fri, 12 May 2023 20:18:13 +0200
Subject: [PATCH 1/6] dahdi: use fallthrough where needed
Use fallthrough instead of comment to fix compilation warning.
Signed-off-by: Christian Marangi <ansuelsmth@gmail.com>
---
drivers/dahdi/dahdi-base.c | 14 +++++++-------
drivers/dahdi/wcaxx-base.c | 2 ++
drivers/dahdi/wctdm24xxp/base.c | 2 ++
drivers/dahdi/xpp/card_global.c | 2 +-
4 files changed, 12 insertions(+), 8 deletions(-)
--- a/drivers/dahdi/dahdi-base.c
+++ b/drivers/dahdi/dahdi-base.c
@@ -7930,7 +7930,7 @@ static inline void __dahdi_process_getau
memset(getlin, 0, DAHDI_CHUNKSIZE * sizeof(short));
txb[0] = DAHDI_LIN2X(0, ms);
memset(txb + 1, txb[0], DAHDI_CHUNKSIZE - 1);
- /* fallthrough */
+ fallthrough;
case DAHDI_CONF_CONF: /* Normal conference mode */
if (is_pseudo_chan(ms)) /* if pseudo-channel */
{
@@ -7954,7 +7954,7 @@ static inline void __dahdi_process_getau
memset(txb + 1, txb[0], DAHDI_CHUNKSIZE - 1);
break;
}
- /* fall through */
+ fallthrough;
case DAHDI_CONF_CONFMON: /* Conference monitor mode */
if (ms->confmode & DAHDI_CONF_LISTENER) {
/* Subtract out last sample written to conf */
@@ -8493,7 +8493,7 @@ static void __dahdi_hooksig_pvt(struct d
break;
}
#endif
- /* fallthrough */
+ fallthrough;
case DAHDI_SIG_FXSGS: /* FXS Groundstart */
if (rxsig == DAHDI_RXSIG_ONHOOK) {
chan->ringdebtimer = RING_DEBOUNCE_TIME;
@@ -8512,7 +8512,7 @@ static void __dahdi_hooksig_pvt(struct d
chan->gotgs = 1;
}
}
- /* fallthrough */
+ fallthrough;
case DAHDI_SIG_FXOLS: /* FXO Loopstart */
case DAHDI_SIG_FXOKS: /* FXO Kewlstart */
switch(rxsig) {
@@ -8612,7 +8612,7 @@ void dahdi_rbsbits(struct dahdi_chan *ch
__dahdi_hooksig_pvt(chan, DAHDI_RXSIG_START);
break;
}
- /* Fall through */
+ fallthrough;
case DAHDI_SIG_EM_E1:
case DAHDI_SIG_FXOLS: /* FXO Loopstart */
case DAHDI_SIG_FXOKS: /* FXO Kewlstart */
@@ -8630,7 +8630,7 @@ void dahdi_rbsbits(struct dahdi_chan *ch
break;
case DAHDI_SIG_FXSKS: /* FXS Kewlstart */
case DAHDI_SIG_FXSGS: /* FXS Groundstart */
- /* Fall through */
+ fallthrough;
case DAHDI_SIG_FXSLS:
if (!(cursig & DAHDI_BBIT)) {
/* Check for ringing first */
@@ -9059,7 +9059,7 @@ static inline void __dahdi_process_putau
memcpy(ss->putlin, putlin, DAHDI_CHUNKSIZE * sizeof(short));
break;
}
- /* fall through */
+ fallthrough;
case DAHDI_CONF_CONFANN: /* Conference with announce */
if (ms->confmode & DAHDI_CONF_TALKER) {
/* Store temp value */
--- a/drivers/dahdi/wcaxx-base.c
+++ b/drivers/dahdi/wcaxx-base.c
@@ -1456,7 +1456,7 @@ wcaxx_check_battery_lost(struct wcaxx *w
break;
case BATTERY_UNKNOWN:
mod_hooksig(wc, mod, DAHDI_RXSIG_ONHOOK);
- /* fallthrough */
+ fallthrough;
case BATTERY_PRESENT:
fxo->battery_state = BATTERY_DEBOUNCING_LOST;
fxo->battdebounce_timer = wc->framecount + battdebounce;
@@ -1567,7 +1567,7 @@ wcaxx_check_battery_present(struct wcaxx
break;
case BATTERY_UNKNOWN:
mod_hooksig(wc, mod, DAHDI_RXSIG_OFFHOOK);
- /* fallthrough */
+ fallthrough;
case BATTERY_LOST:
fxo->battery_state = BATTERY_DEBOUNCING_PRESENT;
fxo->battdebounce_timer = wc->framecount + battdebounce;
--- a/drivers/dahdi/wctdm24xxp/base.c
+++ b/drivers/dahdi/wctdm24xxp/base.c
@@ -1964,7 +1964,7 @@ wctdm_check_battery_lost(struct wctdm *w
break;
case BATTERY_UNKNOWN:
mod_hooksig(wc, mod, DAHDI_RXSIG_ONHOOK);
- /* fallthrough */
+ fallthrough;
case BATTERY_PRESENT:
fxo->battery_state = BATTERY_DEBOUNCING_LOST;
fxo->battdebounce_timer = wc->framecount + battdebounce;
@@ -2074,7 +2074,7 @@ wctdm_check_battery_present(struct wctdm
break;
case BATTERY_UNKNOWN:
mod_hooksig(wc, mod, DAHDI_RXSIG_OFFHOOK);
- /* fallthrough */
+ fallthrough;
case BATTERY_LOST:
fxo->battery_state = BATTERY_DEBOUNCING_PRESENT;
fxo->battdebounce_timer = wc->framecount + battdebounce;
--- a/drivers/dahdi/xpp/card_global.c
+++ b/drivers/dahdi/xpp/card_global.c
@@ -148,7 +148,7 @@ static int execute_chip_command(xpd_t *x
XPD_NOTICE(xpd,
"'I' is deprecated in register commands. "
"Use 'S' instead.\n");
- /* fall through */
+ fallthrough;
case 'S':
do_subreg = 1;
num_args += 2; /* register + subreg */

View file

@ -1,60 +0,0 @@
From eea6daaa4cae1ddcd8e32c8b9e4273ba3244838c Mon Sep 17 00:00:00 2001
From: Christian Marangi <ansuelsmth@gmail.com>
Date: Fri, 12 May 2023 20:19:04 +0200
Subject: [PATCH 2/6] dahdi: fix always true compilation warning
Fix always true compilation warning on statically allocated array. Check
content of the array instead.
Signed-off-by: Christian Marangi <ansuelsmth@gmail.com>
---
drivers/dahdi/dahdi-base.c | 6 +++---
drivers/dahdi/dahdi_dynamic_ethmf.c | 2 +-
drivers/dahdi/xpp/xbus-core.c | 2 +-
3 files changed, 5 insertions(+), 5 deletions(-)
--- a/drivers/dahdi/dahdi-base.c
+++ b/drivers/dahdi/dahdi-base.c
@@ -928,9 +928,9 @@ static int dahdi_seq_show(struct seq_fil
if (!s)
return -ENODEV;
- if (s->name)
+ if (*(s->name))
seq_printf(sfile, "Span %d: %s ", s->spanno, s->name);
- if (s->desc)
+ if (*(s->desc))
seq_printf(sfile, "\"%s\"", s->desc);
else
seq_printf(sfile, "\"\"");
@@ -969,7 +969,7 @@ static int dahdi_seq_show(struct seq_fil
for (x = 0; x < s->channels; x++) {
struct dahdi_chan *chan = s->chans[x];
- if (chan->name)
+ if (*(chan->name))
seq_printf(sfile, "\t%4d %s ", chan->channo,
chan->name);
--- a/drivers/dahdi/dahdi_dynamic_ethmf.c
+++ b/drivers/dahdi/dahdi_dynamic_ethmf.c
@@ -535,7 +535,7 @@ static void ztdethmf_destroy(struct dahd
kfree(z->msgbuf);
kfree(z);
} else {
- if (z && z->span && z->span->name) {
+ if (z && z->span && *(z->span->name)) {
printk(KERN_ERR "Cannot find interface for %s\n",
z->span->name);
}
--- a/drivers/dahdi/xpp/xbus-core.c
+++ b/drivers/dahdi/xpp/xbus-core.c
@@ -120,7 +120,7 @@ int xbus_check_unique(xbus_t *xbus)
{
if (!xbus)
return -ENOENT;
- if (xbus->label && *(xbus->label)) {
+ if (*(xbus->label)) {
xbus_t *xbus_old;
XBUS_DBG(DEVICES, xbus, "Checking LABEL='%s'\n", xbus->label);

View file

@ -1,28 +0,0 @@
From d0699f781e96df6c1fd10551c92fa27695b297da Mon Sep 17 00:00:00 2001
From: Christian Marangi <ansuelsmth@gmail.com>
Date: Fri, 12 May 2023 20:19:45 +0200
Subject: [PATCH 3/6] dahdi-sysfs-chan: fix bug if clause does not guard
Fix bug if clause does not guard by a typo by missing the if clause and
not correctly removing the device.
Signed-off-by: Christian Marangi <ansuelsmth@gmail.com>
---
drivers/dahdi/dahdi-sysfs-chan.c | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
--- a/drivers/dahdi/dahdi-sysfs-chan.c
+++ b/drivers/dahdi/dahdi-sysfs-chan.c
@@ -381,10 +381,11 @@ static void fixed_devfiles_remove(void)
return;
for (i = 0; i < ARRAY_SIZE(fixed_minors); i++) {
void *d = fixed_minors[i].dev;
- if (d && !IS_ERR(d))
+ if (d && !IS_ERR(d)) {
dahdi_dbg(DEVICES, "Removing fixed device file %s\n",
fixed_minors[i].name);
DEL_DAHDI_DEV(fixed_minors[i].minor);
+ }
}
}

View file

@ -1,38 +0,0 @@
From 88cfe20bcd0be443fc7613fd287147d1c54b5f7f Mon Sep 17 00:00:00 2001
From: Christian Marangi <ansuelsmth@gmail.com>
Date: Fri, 12 May 2023 20:21:39 +0200
Subject: [PATCH 5/6] dahdi: skip checking on releasing
Skip checking on releasing since xb is statically allocated and always
present.
Signed-off-by: Christian Marangi <ansuelsmth@gmail.com>
---
drivers/dahdi/wcte13xp-base.c | 3 +--
drivers/dahdi/wcte43x-base.c | 3 +--
2 files changed, 2 insertions(+), 4 deletions(-)
--- a/drivers/dahdi/wcte13xp-base.c
+++ b/drivers/dahdi/wcte13xp-base.c
@@ -2707,8 +2707,7 @@ static int __devinit te13xp_init_one(str
return 0;
fail_exit:
- if (&wc->xb)
- wcxb_release(&wc->xb);
+ wcxb_release(&wc->xb);
free_wc(wc);
return res;
--- a/drivers/dahdi/wcte43x-base.c
+++ b/drivers/dahdi/wcte43x-base.c
@@ -3521,8 +3521,7 @@ static int __devinit t43x_init_one(struc
return 0;
fail_exit:
- if (&wc->xb)
- wcxb_release(&wc->xb);
+ wcxb_release(&wc->xb);
if (debug)
dev_info(&wc->xb.pdev->dev, "***At fail_exit in init_one***\n");

View file

@ -1,44 +0,0 @@
From 14a9e676d635b1c2be1bab4114cc76c1793892d0 Mon Sep 17 00:00:00 2001
From: Christian Marangi <ansuelsmth@gmail.com>
Date: Fri, 12 May 2023 20:22:31 +0200
Subject: [PATCH 6/6] dahdi: xpp: fix wrong printf to %d
Fix wrong printf that should be %d with int variables.
Signed-off-by: Christian Marangi <ansuelsmth@gmail.com>
---
drivers/dahdi/xpp/xbus-core.c | 2 +-
drivers/dahdi/xpp/xframe_queue.c | 4 ++--
2 files changed, 3 insertions(+), 3 deletions(-)
--- a/drivers/dahdi/xpp/xbus-core.c
+++ b/drivers/dahdi/xpp/xbus-core.c
@@ -1772,7 +1772,7 @@ static void xbus_fill_proc_queue(struct
s32 rem;
s64 lag_sec = div_s64_rem(q->worst_lag_usec, 1000, &rem);
seq_printf(sfile,
- "%-15s: counts %3d, %3d, %3d worst %3d, overflows %3d worst_lag %02lld.%ld ms\n",
+ "%-15s: counts %3d, %3d, %3d worst %3d, overflows %3d worst_lag %02lld.%d ms\n",
q->name, q->steady_state_count, q->count, q->max_count,
q->worst_count, q->overflows, lag_sec,
rem);
--- a/drivers/dahdi/xpp/xframe_queue.c
+++ b/drivers/dahdi/xpp/xframe_queue.c
@@ -44,7 +44,7 @@ static void __xframe_dump_queue(struct x
s32 rem;
s64 sec = div_s64_rem(ktime_us_delta(now, xframe->kt_queued), 1000, &rem);
- snprintf(prefix, ARRAY_SIZE(prefix), " %3d> %5lld.%03ld msec",
+ snprintf(prefix, ARRAY_SIZE(prefix), " %3d> %5lld.%03d msec",
i++, sec, rem);
dump_packet(prefix, pack, 1);
}
@@ -64,7 +64,7 @@ static bool __xframe_enqueue(struct xfra
if ((overflow_cnt++ % 1000) < 5) {
s32 rem;
s64 lag_sec = div_s64_rem(q->worst_lag_usec, 1000, &rem);
- NOTICE("Overflow of %-15s: counts %3d, %3d, %3d worst %3d, overflows %3d worst_lag %02lld.%ld ms\n",
+ NOTICE("Overflow of %-15s: counts %3d, %3d, %3d worst %3d, overflows %3d worst_lag %02lld.%d ms\n",
q->name, q->steady_state_count, q->count,
q->max_count, q->worst_count, q->overflows,
lag_sec,

View file

@ -9,7 +9,7 @@ include $(TOPDIR)/rules.mk
PKG_NAME:=dahdi-tools
PKG_VERSION:=3.1.0
PKG_RELEASE:=3
PKG_RELEASE:=2
PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.gz
PKG_SOURCE_URL:=https://downloads.asterisk.org/pub/telephony/dahdi-tools/releases

View file

@ -1,10 +0,0 @@
--- a/xpp/hexfile.h
+++ b/xpp/hexfile.h
@@ -26,6 +26,7 @@
#include <stdarg.h>
#include <stdio.h>
#include <stdint.h>
+#include <sys/cdefs.h>
#include <sys/param.h>
#include <syslog.h>
#define PACKED __attribute__((packed))

View file

@ -8,7 +8,7 @@
include $(TOPDIR)/rules.mk
PKG_NAME:=freetdm
PKG_RELEASE:=2
PKG_RELEASE:=1
PKG_MAINTAINER:=Sebastian Kemper <sebastian_ml@gmx.net>
PKG_SOURCE_PROTO:=git
@ -41,6 +41,7 @@ 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 \

View file

@ -9,7 +9,7 @@ include $(TOPDIR)/rules.mk
PKG_NAME:=gsmlib
PKG_VERSION:=1.10-20140304
PKG_RELEASE:=5
PKG_RELEASE:=3
PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.xz
PKG_SOURCE_URL:=https://github.com/vbouchaud/gsmlib.git
@ -31,6 +31,7 @@ PKG_LICENSE:=LGPL-2.1+
PKG_LICENSE_FILES:=COPYING
PKG_MAINTAINER:=Sebastian Kemper <sebastian_ml@gmx.net>
include $(INCLUDE_DIR)/uclibc++.mk
include $(INCLUDE_DIR)/package.mk
define Package/$(PKG_NAME)/Default
@ -43,7 +44,7 @@ $(call Package/$(PKG_NAME)/Default)
SECTION:=libs
CATEGORY:=Libraries
TITLE:=GSM mobile phone access lib
DEPENDS:=+libstdcpp
DEPENDS:=$(CXX_DEPENDS)
endef
define Package/gsm-utils
@ -64,8 +65,6 @@ endef
CONFIGURE_ARGS += --disable-nls
TARGET_CXXFLAGS += -std=c++11
define Build/InstallDev
$(INSTALL_DIR) $(1)/usr/include/$(PKG_NAME)
$(INSTALL_DATA) \

View file

@ -9,7 +9,7 @@ include $(TOPDIR)/rules.mk
PKG_NAME:=libctb
PKG_VERSION:=0.16
PKG_RELEASE:=3
PKG_RELEASE:=2
PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.gz
PKG_SOURCE_URL:=https://iftools.com/download/ctb/$(PKG_VERSION)
@ -23,6 +23,7 @@ PKG_LICENSE:=LGPL
PKG_LICENSE_FILES:=build/COPYING
PKG_MAINTAINER:=Sebastian Kemper <sebastian_ml@gmx.net>
include $(INCLUDE_DIR)/uclibc++.mk
include $(INCLUDE_DIR)/package.mk
define Package/$(PKG_NAME)
@ -31,7 +32,7 @@ define Package/$(PKG_NAME)
CATEGORY:=Libraries
TITLE:=Communications toolbox - ctb
URL:=https://iftools.com/opensource/ctb.en.php
DEPENDS:=+libstdcpp
DEPENDS:=$(CXX_DEPENDS)
endef
define Package/$(PKG_NAME)/description

View file

@ -9,12 +9,12 @@ include $(TOPDIR)/rules.mk
PKG_NAME:=libks
PKG_VERSION:=2.0.2
PKG_VERSION:=1.7.0
PKG_RELEASE:=1
PKG_SOURCE:=libks-$(PKG_VERSION).tar.gz
PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.gz
PKG_SOURCE_URL:=https://codeload.github.com/signalwire/libks/tar.gz/v$(PKG_VERSION)?
PKG_HASH:=af94f9fcdb2022b8f09187309ac2d372a5a4cc639af77cd4375f2d5c88b4fd63
PKG_HASH:=73c5751eadad4d3390d61b9765e9b860e0aba7336044ecf8b007dfc1818baa69
PKG_BUILD_PARALLEL:=1
CMAKE_INSTALL:=1
@ -33,13 +33,13 @@ PKG_MAINTAINER:=Sebastian Kemper <sebastian_ml@gmx.net>
include $(INCLUDE_DIR)/package.mk
include $(INCLUDE_DIR)/cmake.mk
define Package/libks
define Package/$(PKG_NAME)
SUBMENU:=Telephony
SECTION:=libs
CATEGORY:=Libraries
TITLE:=Foundational support for SignalWire C products
URL:=https://github.com/signalwire/libks
ABI_VERSION:=2
ABI_VERSION:=1
DEPENDS:=+libatomic +libopenssl +libuuid
endef
@ -47,20 +47,20 @@ endef
TARGET_CFLAGS += $(TARGET_CPPFLAGS)
define Build/InstallDev
$(INSTALL_DIR) $(1)/usr/include/libks2/libks/cmake
$(INSTALL_DATA) $(PKG_INSTALL_DIR)/usr/include/libks2/libks/*.h \
$(1)/usr/include/libks2/libks
$(INSTALL_DIR) $(1)/usr/lib/pkgconfig
$(INSTALL_DATA) $(PKG_INSTALL_DIR)/usr/include/libks2/libks/cmake/* \
$(1)/usr/include/libks2/libks/cmake
$(CP) $(PKG_INSTALL_DIR)/usr/lib/libks2.so* $(1)/usr/lib
$(INSTALL_DATA) $(PKG_INSTALL_DIR)/usr/lib/pkgconfig/libks2.pc \
$(INSTALL_DIR) $(1)/usr/include/$(PKG_NAME)
$(INSTALL_DATA) $(PKG_INSTALL_DIR)/usr/include/$(PKG_NAME)/*.h \
$(1)/usr/include/$(PKG_NAME)
$(INSTALL_DIR) $(1)/usr/lib/{cmake/$(PKG_NAME),pkgconfig}
$(INSTALL_DATA) $(PKG_INSTALL_DIR)/usr/include/$(PKG_NAME)/cmake/* \
$(1)/usr/lib/cmake/$(PKG_NAME)
$(CP) $(PKG_INSTALL_DIR)/usr/lib/$(PKG_NAME).so* $(1)/usr/lib
$(INSTALL_DATA) $(PKG_INSTALL_DIR)/usr/lib/pkgconfig/$(PKG_NAME).pc \
$(1)/usr/lib/pkgconfig
endef
define Package/libks/install
define Package/$(PKG_NAME)/install
$(INSTALL_DIR) $(1)/usr/lib
$(CP) $(PKG_INSTALL_DIR)/usr/lib/libks2.so.$(ABI_VERSION)* $(1)/usr/lib
$(CP) $(PKG_INSTALL_DIR)/usr/lib/$(PKG_NAME).so.$(ABI_VERSION)* $(1)/usr/lib
endef
$(eval $(call BuildPackage,libks))
$(eval $(call BuildPackage,$(PKG_NAME)))

View file

@ -1,6 +1,6 @@
--- a/src/include/libks/ks_platform.h
+++ b/src/include/libks/ks_platform.h
@@ -93,7 +93,7 @@ KS_BEGIN_EXTERN_C
@@ -91,7 +91,7 @@ KS_BEGIN_EXTERN_C
#include <sys/time.h>
#include <sys/select.h>
#include <netinet/tcp.h>

View file

@ -4,9 +4,9 @@
# Must include cotire before anything else for auto pch setup
#include(cmake/cotire.cmake)
+# Declare our project, libks2
+project(LibKS2 VERSION 2.0.2 LANGUAGES C CXX)
+message("LibKS2 Version ${PROJECT_VERSION_MAJOR}.${PROJECT_VERSION_MINOR}")
+# Declare our project, libks
+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
include(cmake/ksutil.cmake)
@ -15,9 +15,9 @@
endif()
endif()
-# Declare our project, libks2
-project(LibKS2 VERSION 2.0.2 LANGUAGES C CXX)
-message("LibKS2 Version ${PROJECT_VERSION_MAJOR}.${PROJECT_VERSION_MINOR}")
-# Declare our project, libks
-project(LibKS VERSION 1.7.0 LANGUAGES C CXX)
-message("LibKS Version ${PROJECT_VERSION_MAJOR}.${PROJECT_VERSION_MINOR}")
-
# Set package version
set(CPACK_PACKAGE_VERSION_MAJOR ${PROJECT_VERSION_MAJOR})

View file

@ -8,12 +8,12 @@
include $(TOPDIR)/rules.mk
PKG_NAME:=libosip2
PKG_VERSION:=5.3.0
PKG_VERSION:=5.1.2
PKG_RELEASE:=1
PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.gz
PKG_SOURCE_URL:=@GNU/osip
PKG_HASH:=f4725916c22cf514969efb15c3c207233d64739383f7d42956038b78f6cae8c8
PKG_HASH:=2bc0400f21a64cf4f2cbc9827bf8bdbb05a9b52ecc8e791b4ec0f1f9410c1291
PKG_FIXUP:=autoreconf
PKG_INSTALL:=1
@ -30,7 +30,7 @@ define Package/libosip2
CATEGORY:=Libraries
TITLE:=GNU oSIP library
URL:=http://www.gnu.org/software/osip/
ABI_VERSION:=15
ABI_VERSION:=13
DEPENDS:=+librt
endef

View file

@ -9,7 +9,7 @@ include $(TOPDIR)/rules.mk
PKG_NAME:=libpri
PKG_VERSION:=1.6.0
PKG_RELEASE:=4
PKG_RELEASE:=3
PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.gz
PKG_SOURCE_URL:=https://downloads.asterisk.org/pub/telephony/libpri/releases
@ -35,10 +35,6 @@ define Package/libpri/description
Lucent 5E Custom protocols on switches from Nortel and Lucent.
endef
MAKE_FLAGS += \
OSARCH=Linux \
LDCONFIG=ldconfig
define Build/Configure
endef

View file

@ -1,5 +1,7 @@
--- a/pritest.c
+++ b/pritest.c
Index: libpri-1.4.15/pritest.c
===================================================================
--- libpri-1.4.15.orig/pritest.c
+++ libpri-1.4.15/pritest.c
@@ -41,7 +41,7 @@
#include <sys/ioctl.h>
#include <stdlib.h>
@ -9,8 +11,10 @@
#include <sys/select.h>
#include <sys/wait.h>
#include <sys/resource.h>
--- a/testprilib.c
+++ b/testprilib.c
Index: libpri-1.4.15/testprilib.c
===================================================================
--- libpri-1.4.15.orig/testprilib.c
+++ libpri-1.4.15/testprilib.c
@@ -41,7 +41,7 @@
#include <sys/ioctl.h>
#include <stdlib.h>

View file

@ -1,39 +0,0 @@
Upstream issue: https://issues.asterisk.org/jira/browse/PRI-188
From ec1d6589c6e4eb6550cb92d5e0f214f7b31e8d5f Mon Sep 17 00:00:00 2001
From: "Sergey V. Lobanov" <sergey@lobanov.in>
Date: Sun, 30 Jan 2022 13:25:17 +0300
Subject: [PATCH] Add an ability to build libpri on MacOS for Linux target
This patch allows to rededine ar and ranlib tool using AR and
RANLIB make flags.
Fixes: PRI-188
Signed-off-by: Sergey V. Lobanov <sergey@lobanov.in>
---
Makefile | 6 ++++--
1 file changed, 4 insertions(+), 2 deletions(-)
--- a/Makefile
+++ b/Makefile
@@ -27,6 +27,8 @@
CC=gcc
GREP=grep
AWK=awk
+AR=ar
+RANLIB=ranlib
OSARCH=$(shell uname -s)
PROC?=$(shell uname -m)
@@ -193,8 +195,8 @@ MAKE_DEPS= -MD -MT $@ -MF .$(subst /,_,$
$(CC) $(CFLAGS) $(MAKE_DEPS) -c -o $@ $<
$(STATIC_LIBRARY): $(STATIC_OBJS)
- ar rcs $(STATIC_LIBRARY) $(STATIC_OBJS)
- ranlib $(STATIC_LIBRARY)
+ $(AR) rcs $(STATIC_LIBRARY) $(STATIC_OBJS)
+ $(RANLIB) $(STATIC_LIBRARY)
$(DYNAMIC_LIBRARY): $(DYNAMIC_OBJS)
$(CC) $(SOFLAGS) -o $@ $(DYNAMIC_OBJS)

View file

@ -8,12 +8,12 @@
include $(TOPDIR)/rules.mk
PKG_NAME:=libsrtp
PKG_VERSION:=2.4.2
PKG_RELEASE:=2
PKG_VERSION:=2.3.0
PKG_RELEASE:=1
PKG_SOURCE:=libsrtp-$(PKG_VERSION).tar.gz
PKG_SOURCE_URL:=https://codeload.github.com/cisco/libsrtp/tar.gz/v$(PKG_VERSION)?
PKG_HASH:=3b1bcb14ebda572b04b9bdf07574a449c84cb924905414e4d94e62837d22b628
PKG_HASH:=94093a5d04c5f4743e8d81182b76938374df6d393b45322f24960d250b0110e8
PKG_LICENSE:=BSD-3-Clause
PKG_LICENSE_FILES:=LICENSE
@ -21,16 +21,13 @@ PKG_MAINTAINER:=Jiri Slachta <jiri@slachta.eu>
include $(INCLUDE_DIR)/package.mk
CONFIGURE_ARGS+=--enable-openssl
define Package/libsrtp2
SUBMENU:=Telephony
SECTION:=libs
CATEGORY:=Libraries
TITLE:=Secure RTP (SRTP) library, v$(PKG_VERSION)
URL:=https://github.com/cisco/libsrtp
DEPENDS:=+libopenssl
ABI_VERSION:=1
URL:=http://sourceforge.net/projects/srtp
DEPENDS:=
endef
define Package/libsrtp2/description
@ -55,7 +52,7 @@ endef
define Package/libsrtp2/install
$(INSTALL_DIR) $(1)/usr/lib
$(CP) \
$(PKG_INSTALL_DIR)/usr/lib/libsrtp2.so.$(ABI_VERSION)* \
$(PKG_INSTALL_DIR)/usr/lib/libsrtp2.so.* \
$(1)/usr/lib/
endef

View file

@ -0,0 +1,11 @@
--- a/crypto/math/datatypes.c
+++ b/crypto/math/datatypes.c
@@ -79,7 +79,7 @@ int octet_get_weight(uint8_t octet)
/* the value MAX_PRINT_STRING_LEN is defined in datatypes.h */
-char bit_string[MAX_PRINT_STRING_LEN];
+static char bit_string[MAX_PRINT_STRING_LEN];
uint8_t srtp_nibble_to_hex_char(uint8_t nibble)
{

View file

@ -10,15 +10,14 @@
include $(TOPDIR)/rules.mk
PKG_NAME:=pjproject
PKG_VERSION:=2.13.1
PKG_RELEASE:=2
PKG_CPE_ID:=cpe:/a:pjsip:pjsip
PKG_VERSION:=2.10
PKG_RELEASE:=7
# download "vX.Y.tar.gz" as "pjproject-vX.Y.tar.gz"
PKG_SOURCE_URL_FILE:=$(PKG_VERSION).tar.gz
PKG_SOURCE:=$(PKG_NAME)-$(PKG_SOURCE_URL_FILE)
PKG_SOURCE_URL:=https://github.com/pjsip/$(PKG_NAME)/archive/refs/tags
PKG_HASH:=32a5ab5bfbb9752cb6a46627e4c410e61939c8dbbd833ac858473cfbd9fb9d7d
PKG_SOURCE_URL:=https://github.com/pjsip/$(PKG_NAME)/archive
PKG_HASH:=936a4c5b98601b52325463a397ddf11ab4106c6a7b04f8dc7cdd377efbb597de
PKG_INSTALL:=1
PKG_LICENSE:=GPL-2.0
@ -29,6 +28,7 @@ PKG_BUILD_DIR:=$(BUILD_DIR)/$(PKG_NAME)-$(PKG_VERSION)
PKG_CONFIG_DEPENDS:=CONFIG_SOFT_FLOAT
include $(INCLUDE_DIR)/uclibc++.mk
include $(INCLUDE_DIR)/package.mk
define Package/pjproject/Default
@ -36,7 +36,7 @@ define Package/pjproject/Default
CATEGORY:=Libraries
SUBMENU:=Telephony
URL:=https://www.pjsip.org
DEPENDS:=+libstdcpp +libopenssl +libuuid +libpthread
DEPENDS:=$(CXX_DEPENDS) +libopenssl +libuuid +libpthread
endef
define Package/pjproject/install/lib
@ -60,7 +60,6 @@ endef
CONFIGURE_ARGS+= \
$(if $(CONFIG_SOFT_FLOAT),--disable-floating-point) \
--disable-android-mediacodec \
--disable-bcg729 \
--disable-darwin-ssl \
--disable-ext-sound \
@ -72,7 +71,6 @@ CONFIGURE_ARGS+= \
--disable-ilbc-codec \
--disable-ipp \
--disable-l16-codec \
--disable-libsrtp \
--disable-libwebrtc \
--disable-libyuv \
--disable-opencore-amr \
@ -84,10 +82,10 @@ CONFIGURE_ARGS+= \
--disable-sound \
--disable-speex-aec \
--disable-speex-codec \
--disable-upnp \
--disable-v4l2 \
--disable-video \
--enable-shared \
--with-external-srtp="$(STAGING_DIR)/usr" \
--with-ssl="$(STAGING_DIR)/usr" \
--without-external-gsm \
--without-external-pa \
@ -96,8 +94,8 @@ CONFIGURE_ARGS+= \
TARGET_CFLAGS+=$(TARGET_CPPFLAGS)
define Build/Compile
$(MAKE) $(PKG_JOBS) -C $(PKG_BUILD_DIR) EXCLUDE_APP=1 dep
$(MAKE) $(PKG_JOBS) -C $(PKG_BUILD_DIR) EXCLUDE_APP=1
$(MAKE) $(PKG_JOBS) -C $(PKG_BUILD_DIR) dep
$(MAKE) $(PKG_JOBS) -C $(PKG_BUILD_DIR)
endef
PJPROJECT_LIBS:= \
@ -112,16 +110,17 @@ define Build/InstallDev
$(foreach m,$(PJPROJECT_LIBS),$(CP) $(PKG_INSTALL_DIR)/usr/lib/$(m)* $(1)/usr/lib;)
$(INSTALL_DIR) $(1)/usr/lib/pkgconfig
$(SED) 's|$(TARGET_CFLAGS)||g' $(PKG_INSTALL_DIR)/usr/lib/pkgconfig/libpjproject.pc
$(INSTALL_DATA) $(PKG_INSTALL_DIR)/usr/lib/pkgconfig/libpjproject.pc \
$(1)/usr/lib/pkgconfig
endef
$(eval $(call PJSIPpackage,libpj,libpj,+librt))
$(eval $(call PJSIPpackage,libpjlib-util,libpjlib-util,+libpj +librt))
$(eval $(call PJSIPpackage,libpjmedia,libpjmedia*,+libpj +libpjlib-util +libpjnath +librt))
$(eval $(call PJSIPpackage,libpjmedia,libpjmedia*,+libpj +libpjlib-util +libpjnath +librt +libsrtp2))
$(eval $(call PJSIPpackage,libpjnath,libpjnath,+libpj +libpjlib-util +librt))
$(eval $(call PJSIPpackage,libpjsip-simple,libpjsip-simple,+libpj +libpjlib-util +libpjsip +librt))
$(eval $(call PJSIPpackage,libpjsip-ua,libpjsip-ua,+libpj +libpjlib-util +libpjmedia +libpjsip-simple +libpjsip +librt))
$(eval $(call PJSIPpackage,libpjsip,libpjsip,+libpj +libpjlib-util +librt))
$(eval $(call PJSIPpackage,libpjsip,libpjsip,+libpj +libpjlib-util +librt +libsrtp2))
$(eval $(call PJSIPpackage,libpjsua,libpjsua,+libpj +libpjlib-util +libpjmedia +libpjnath +libpjsip-simple +libpjsip-ua +libpjsip +librt))
$(eval $(call PJSIPpackage,libpjsua2,libpjsua2,+libpj +libpjlib-util +libpjmedia +libpjnath +libpjsip-simple +libpjsip-ua +libpjsip +librt +libpjsua))

View file

@ -0,0 +1,11 @@
--- a/build/rules.mak
+++ b/build/rules.mak
@@ -13,7 +13,7 @@ SHLIB = $($(APP)_SHLIB)
SONAME = $($(APP)_SONAME)
ifeq ($(SHLIB_SUFFIX),so)
-SHLIB_OPT := -shared -Wl,-soname,$(SHLIB)
+SHLIB_OPT := -shared
else ifeq ($(SHLIB_SUFFIX),dylib)
SHLIB_OPT := -dynamiclib -undefined dynamic_lookup -flat_namespace
else ifeq ($(SHLIB_SUFFIX),dll)

View file

@ -0,0 +1,20 @@
--- a/pjlib/src/pj/os_core_unix.c
+++ b/pjlib/src/pj/os_core_unix.c
@@ -1139,7 +1139,7 @@ static pj_status_t init_mutex(pj_mutex_t
return PJ_RETURN_OS_ERROR(rc);
if (type == PJ_MUTEX_SIMPLE) {
-#if (defined(PJ_LINUX) && PJ_LINUX!=0) || \
+#if (defined(PJ_LINUX) && PJ_LINUX!=0 && defined(__GLIBC__)) || \
defined(PJ_HAS_PTHREAD_MUTEXATTR_SETTYPE)
rc = pthread_mutexattr_settype(&attr, PTHREAD_MUTEX_NORMAL);
#elif (defined(PJ_RTEMS) && PJ_RTEMS!=0) || \
@@ -1149,7 +1149,7 @@ static pj_status_t init_mutex(pj_mutex_t
rc = pthread_mutexattr_settype(&attr, PTHREAD_MUTEX_NORMAL);
#endif
} else {
-#if (defined(PJ_LINUX) && PJ_LINUX!=0) || \
+#if (defined(PJ_LINUX) && PJ_LINUX!=0 && defined(__GLIBC__)) || \
defined(PJ_HAS_PTHREAD_MUTEXATTR_SETTYPE)
rc = pthread_mutexattr_settype(&attr, PTHREAD_MUTEX_RECURSIVE);
#elif (defined(PJ_RTEMS) && PJ_RTEMS!=0) || \

View file

@ -1,6 +1,6 @@
--- /dev/null
+++ b/pjlib/include/pj/config_site.h
@@ -0,0 +1,91 @@
@@ -0,0 +1,79 @@
+/*
+ * Asterisk config_site.h
+ */
@ -70,7 +70,7 @@
+/* Increase limits to allow more formats */
+#define PJMEDIA_MAX_SDP_FMT 64
+#define PJMEDIA_MAX_SDP_BANDW 4
+#define PJMEDIA_MAX_SDP_ATTR (PJMEDIA_MAX_SDP_FMT*3 + 4)
+#define PJMEDIA_MAX_SDP_ATTR (PJMEDIA_MAX_SDP_FMT*2 + 4)
+#define PJMEDIA_MAX_SDP_MEDIA 16
+
+/*
@ -80,15 +80,3 @@
+ */
+#define PJSIP_TCP_KEEP_ALIVE_INTERVAL 0
+#define PJSIP_TLS_KEEP_ALIVE_INTERVAL 0
+
+#define PJSIP_TSX_UAS_CONTINUE_ON_TP_ERROR 0
+#define PJ_SSL_SOCK_OSSL_USE_THREAD_CB 0
+#define PJSIP_AUTH_ALLOW_MULTIPLE_AUTH_HEADER 1
+
+/*
+ * The default is 32 with 8 being used by pjproject itself.
+ * Since this value is used in invites, dialogs, transports
+ * and subscriptions as well as the global pjproject endpoint,
+ * we don't want to increase it too much.
+ */
+#define PJSIP_MAX_MODULE 38

View file

@ -0,0 +1,22 @@
--- a/build.mak.in
+++ b/build.mak.in
@@ -296,7 +296,6 @@ export APP_LDLIBS := $(PJSUA_LIB_LDLIB)
$(PJLIB_LDLIB) \
@LIBS@
export APP_LDXXLIBS := $(PJSUA2_LIB_LDLIB) \
- -lstdc++ \
$(APP_LDLIBS)
# Here are the variabels to use if application is using the library
--- a/pjsip/build/Makefile
+++ b/pjsip/build/Makefile
@@ -152,8 +152,7 @@ export PJSUA2_LIB_LDFLAGS += $(PJSUA_LIB
$(PJNATH_LDLIB) \
$(PJLIB_UTIL_LDLIB) \
$(PJLIB_LDLIB) \
- $(_LDFLAGS) \
- -lstdc++
+ $(_LDFLAGS)
###############################################################################

View file

@ -13,12 +13,13 @@
Description: Multimedia communication library
--- a/build.mak.in
+++ b/build.mak.in
@@ -352,6 +352,6 @@ export PJ_LIBXX_FILES := $(APP_LIBXX_FIL
@@ -314,8 +314,7 @@ export PJ_LIBXX_FILES := $(APP_LIBXX_FIL
# And here are the variables to use if application is using the
# library from the install location (i.e. --prefix)
export PJ_INSTALL_DIR := @prefix@
export PJ_INSTALL_INC_DIR := @includedir@
-export PJ_INSTALL_INC_DIR := @includedir@
export PJ_INSTALL_LIB_DIR := @libdir@
-export PJ_INSTALL_CFLAGS := -I$(PJ_INSTALL_INC_DIR) -DPJ_AUTOCONF=1 @ac_cflags@
+export PJ_INSTALL_CFLAGS := -DPJ_AUTOCONF=1 @ac_cflags@
export PJ_INSTALL_LDFLAGS_PRIVATE := $(APP_THIRD_PARTY_LIBS) $(APP_THIRD_PARTY_EXT) @LIBS@
-export PJ_INSTALL_LDFLAGS := -L$(PJ_INSTALL_LIB_DIR) $(filter-out $(PJ_INSTALL_LDFLAGS_PRIVATE),$(APP_LDXXLIBS))
+export PJ_INSTALL_LDFLAGS := $(filter-out $(PJ_INSTALL_LDFLAGS_PRIVATE),$(APP_LDXXLIBS))
-export PJ_INSTALL_CFLAGS := -I$(PJ_INSTALL_INC_DIR) -DPJ_AUTOCONF=1 @CFLAGS@
+export PJ_INSTALL_CFLAGS := -DPJ_AUTOCONF=1 @CFLAGS@
export PJ_INSTALL_CXXFLAGS := @CXXFLAGS@ $(PJ_INSTALL_CFLAGS)
export PJ_INSTALL_LDFLAGS := -L$(PJ_INSTALL_LIB_DIR) $(APP_LDLIBS)

View file

@ -1,27 +0,0 @@
From ac685b30c17be461b2bf5b46a772ed9742b8e985 Mon Sep 17 00:00:00 2001
From: Riza Sulistyo <trengginas@users.noreply.github.com>
Date: Thu, 9 Feb 2023 13:19:23 +0700
Subject: [PATCH] Make sure that NOTIFY tdata is set before sending it.
---
pjsip/src/pjsip-simple/evsub.c | 9 ++++++---
1 file changed, 6 insertions(+), 3 deletions(-)
--- a/pjsip/src/pjsip-simple/evsub.c
+++ b/pjsip/src/pjsip-simple/evsub.c
@@ -2224,9 +2224,12 @@ static void on_tsx_state_uas( pjsip_evsu
/* Send the pending NOTIFY sent by app from inside
* on_rx_refresh() callback.
*/
- pj_assert(sub->pending_notify);
- status = pjsip_evsub_send_request(sub, sub->pending_notify);
- sub->pending_notify = NULL;
+ //pj_assert(sub->pending_notify);
+ /* Make sure that pending_notify is set. */
+ if (sub->pending_notify) {
+ status = pjsip_evsub_send_request(sub, sub->pending_notify);
+ sub->pending_notify = NULL;
+ }
} else if (pjsip_method_cmp(&tsx->method, &pjsip_notify_method)==0) {

View file

@ -0,0 +1,37 @@
commit c3c1bf45cae2a35003aa16c267d59f97027f9c5e
Author: Kevin Harwell <kharwell@digium.com>
Date: Thu Jun 11 11:11:13 2020 -0500
sip_inv - fix invite session ref count crash
Ensure the session's ref count is only decremented under proper conditons.
For more details see the following issue report:
https://github.com/pjsip/pjproject/issues/2443
Patch supplied by sauwming
--- a/pjsip/src/pjsip-ua/sip_inv.c
+++ b/pjsip/src/pjsip-ua/sip_inv.c
@@ -323,9 +323,19 @@ static void inv_set_state(pjsip_inv_sess
(*mod_inv.cb.on_state_changed)(inv, e);
pjsip_inv_dec_ref(inv);
- /* Only decrement when previous state is not already DISCONNECTED */
+ /* The above callback may change the state, so we need to be careful here
+ * and only decrement inv under the following conditions:
+ * 1. If the state parameter is DISCONNECTED, and previous state is not
+ * already DISCONNECTED.
+ * This is to make sure that dec_ref() is not called more than once.
+ * 2. If current state is PJSIP_INV_STATE_DISCONNECTED.
+ * This is to make sure that dec_ref() is not called if user restarts
+ * inv within the callback. Note that this check must be last since
+ * inv may have already been destroyed.
+ */
if (state == PJSIP_INV_STATE_DISCONNECTED &&
- prev_state != PJSIP_INV_STATE_DISCONNECTED)
+ prev_state != PJSIP_INV_STATE_DISCONNECTED &&
+ inv->state == PJSIP_INV_STATE_DISCONNECTED)
{
pjsip_inv_dec_ref(inv);
}

View file

@ -1,26 +0,0 @@
--- a/pjsip/src/pjsip/sip_transport.c
+++ b/pjsip/src/pjsip/sip_transport.c
@@ -2088,15 +2088,17 @@ PJ_DEF(pj_ssize_t) pjsip_tpmgr_receive_p
* which were sent to keep NAT bindings.
*/
if (tmp.slen) {
- PJ_LOG(1, (THIS_FILE,
- "Error processing %d bytes packet from %s %s:%d %.*s:\n"
- "%.*s\n"
- "-- end of packet.",
+ PJ_LOG(2, (THIS_FILE,
+ "Dropping %d bytes packet from %s %s:%d %.*s\n",
msg_fragment_size,
rdata->tp_info.transport->type_name,
- rdata->pkt_info.src_name,
+ rdata->pkt_info.src_name,
rdata->pkt_info.src_port,
- (int)tmp.slen, tmp.ptr,
+ (int)tmp.slen, tmp.ptr));
+ PJ_LOG(4, (THIS_FILE,
+ "Dropped packet:"
+ "%.*s\n"
+ "-- end of packet.",
(int)msg_fragment_size,
rdata->msg_info.msg_buf));
}

View file

@ -0,0 +1,35 @@
commit 40dd48d10911f4ff9b8dfbf16428fbc9acc434ba
Author: Riza Sulistyo <trengginas@users.noreply.github.com>
Date: Thu Jul 9 17:47:24 2020 +0700
Modify timer_id check on cancel() (#2463)
* modify timer_id check on cancel().
* modification based on comments.
--- a/pjlib/include/pj/timer.h
+++ b/pjlib/include/pj/timer.h
@@ -120,7 +120,10 @@ typedef struct pj_timer_entry
/**
* Internal unique timer ID, which is assigned by the timer heap.
- * Application should not touch this ID.
+ * Positive values indicate that the timer entry is running,
+ * while -1 means that it's not. Any other value may indicate that it
+ * hasn't been properly initialised or is in a bad state.
+ * Application should not touch this ID.
*/
pj_timer_id_t _timer_id;
--- a/pjlib/src/pj/timer.c
+++ b/pjlib/src/pj/timer.c
@@ -535,7 +535,7 @@ static int cancel( pj_timer_heap_t *ht,
PJ_CHECK_STACK();
// Check to see if the timer_id is out of range
- if (entry->_timer_id < 0 || (pj_size_t)entry->_timer_id > ht->max_size) {
+ if (entry->_timer_id < 1 || (pj_size_t)entry->_timer_id >= ht->max_size) {
entry->_timer_id = -1;
return 0;
}

View file

@ -0,0 +1,68 @@
From 78683646c8bc670ec730a42494e075f671a08e28 Mon Sep 17 00:00:00 2001
From: Guido Falsi <mad@madpilot.net>
Date: Mon, 11 May 2020 08:50:39 +0200
Subject: [PATCH] Fix race condition in parallel builds (#2426)
* Some targets residing in `OBJDIRS` are missing a dependency on that directory, which results in a race condition, causing build to fail sometimes due to the directory not existing when running parallel builds.
* The `PJSUA_LIB` variable is not defined anywhere, resulting in an empty value, and no correct dependency on the pjsua shared library for `pjsua2`. The correct variable seems to be `PJSUA_LIB_LIB`, defined at the start of this same `Makefile`.
---
build/rules.mak | 12 ++++++------
pjsip/build/Makefile | 2 +-
2 files changed, 7 insertions(+), 7 deletions(-)
--- a/build/rules.mak
+++ b/build/rules.mak
@@ -129,7 +129,7 @@ endif
$(OBJDIR)/$(app).o: $(OBJDIRS) $(OBJS)
$(CROSS_COMPILE)ld -r -o $@ $(OBJS)
-$(OBJDIR)/$(app).ko: $(OBJDIR)/$(app).o
+$(OBJDIR)/$(app).ko: $(OBJDIR)/$(app).o | $(OBJDIRS)
@echo Creating kbuild Makefile...
@echo "# Our module name:" > $(OBJDIR)/Makefile
@echo 'obj-m += $(app).o' >> $(OBJDIR)/Makefile
@@ -154,27 +154,27 @@ $(OBJDIR)/$(app).ko: $(OBJDIR)/$(app).o
../lib/$(app).ko: $(LIB) $(OBJDIR)/$(app).ko
cp $(OBJDIR)/$(app).ko ../lib
-$(OBJDIR)/%$(OBJEXT): $(SRCDIR)/%.m
+$(OBJDIR)/%$(OBJEXT): $(SRCDIR)/%.m | $(OBJDIRS)
$(CC) $($(APP)_CFLAGS) \
$(CC_OUT)$(subst /,$(HOST_PSEP),$@) \
$(subst /,$(HOST_PSEP),$<)
-$(OBJDIR)/%$(OBJEXT): $(SRCDIR)/%.c
+$(OBJDIR)/%$(OBJEXT): $(SRCDIR)/%.c | $(OBJDIRS)
$(CC) $($(APP)_CFLAGS) \
$(CC_OUT)$(subst /,$(HOST_PSEP),$@) \
$(subst /,$(HOST_PSEP),$<)
-$(OBJDIR)/%$(OBJEXT): $(SRCDIR)/%.S
+$(OBJDIR)/%$(OBJEXT): $(SRCDIR)/%.S | $(OBJDIRS)
$(CC) $($(APP)_CFLAGS) \
$(CC_OUT)$(subst /,$(HOST_PSEP),$@) \
$(subst /,$(HOST_PSEP),$<)
-$(OBJDIR)/%$(OBJEXT): $(SRCDIR)/%.cpp
+$(OBJDIR)/%$(OBJEXT): $(SRCDIR)/%.cpp | $(OBJDIRS)
$(CXX) $($(APP)_CXXFLAGS) \
$(CC_OUT)$(subst /,$(HOST_PSEP),$@) \
$(subst /,$(HOST_PSEP),$<)
-$(OBJDIR)/%$(OBJEXT): $(SRCDIR)/%.cc
+$(OBJDIR)/%$(OBJEXT): $(SRCDIR)/%.cc | $(OBJDIRS)
$(CXX) $($(APP)_CXXFLAGS) \
$(CC_OUT)$(subst /,$(HOST_PSEP),$@) \
$(subst /,$(HOST_PSEP),$<)
--- a/pjsip/build/Makefile
+++ b/pjsip/build/Makefile
@@ -261,7 +261,7 @@ $(PJSUA_LIB_LIB) $(PJSUA_LIB_SONAME): $(
pjsua2-lib: $(PJSUA2_LIB_LIB)
$(PJSUA2_LIB_SONAME): $(PJSUA2_LIB_LIB)
-$(PJSUA2_LIB_LIB) $(PJSUA2_LIB_SONAME): $(PJSUA_LIB) $(PSJUA_LIB_SONAME) $(PJSIP_LIB) $(PJSIP_SONAME) $(PJSIP_SIMPLE_LIB) $(PJSIP_SIMPLE_SONAME) $(PJSIP_UA_LIB) $(PJSIP_UA_SONAME)
+$(PJSUA2_LIB_LIB) $(PJSUA2_LIB_SONAME): $(PJSUA_LIB_LIB) $(PJSUA_LIB_SONAME) $(PJSIP_LIB) $(PJSIP_SONAME) $(PJSIP_SIMPLE_LIB) $(PJSIP_SIMPLE_SONAME) $(PJSIP_UA_LIB) $(PJSIP_UA_SONAME)
$(MAKE) -f $(RULES_MAK) APP=PJSUA2_LIB app=pjsua2-lib $(subst /,$(HOST_PSEP),$(LIBDIR)/$@)
pjsip-test: $(TEST_EXE)

View file

@ -0,0 +1,27 @@
--- a/pjmedia/src/pjmedia/sdp_neg.c
+++ b/pjmedia/src/pjmedia/sdp_neg.c
@@ -906,7 +906,7 @@ static pj_status_t process_m_answer( pj_
* after receiving remote answer.
*/
static pj_status_t process_answer(pj_pool_t *pool,
- pjmedia_sdp_session *offer,
+ pjmedia_sdp_session *local_offer,
pjmedia_sdp_session *answer,
pj_bool_t allow_asym,
pjmedia_sdp_session **p_active)
@@ -914,10 +914,14 @@ static pj_status_t process_answer(pj_poo
unsigned omi = 0; /* Offer media index */
unsigned ami = 0; /* Answer media index */
pj_bool_t has_active = PJ_FALSE;
+ pjmedia_sdp_session *offer;
pj_status_t status;
/* Check arguments. */
- PJ_ASSERT_RETURN(pool && offer && answer && p_active, PJ_EINVAL);
+ PJ_ASSERT_RETURN(pool && local_offer && answer && p_active, PJ_EINVAL);
+
+ /* Duplicate local offer SDP. */
+ offer = pjmedia_sdp_session_clone(pool, local_offer);
/* Check that media count match between offer and answer */
// Ticket #527, different media count is allowed for more interoperability,

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:=re
PKG_VERSION:=2.0.1
PKG_VERSION:=1.0.0
PKG_RELEASE:=1
PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.gz
PKG_SOURCE_URL:=https://codeload.github.com/baresip/re/tar.gz/v$(PKG_VERSION)?
PKG_HASH:=43aa439b96aff75fe5768b9f9d49dea97042e42e7647df47b345465763e2f7ed
PKG_HASH:=bf0abfc511b7278462e7d54aaae39e7231b9f35423d5026c8210a322c7c8ef2f
PKG_LICENSE:=BSD-3-Clause
PKG_LICENSE_FILES:=docs/COPYING
@ -32,7 +32,6 @@ define Package/libre
DEPENDS:=+libopenssl +zlib
TITLE:=Generic library for real-time communications with async IO support
URL:=https://github.com/baresip/re
ABI_VERSION:=1
endef
# re.mk is used for this and all related packages (rem, restund and baresip).
@ -69,12 +68,12 @@ define Build/InstallDev
$(INSTALL_DIR) $(1)/usr/include
$(CP) $(PKG_INSTALL_DIR)/usr/include/re $(1)/usr/include
$(INSTALL_DIR) $(1)/usr/lib
$(CP) $(PKG_INSTALL_DIR)/usr/lib/libre.{a,so*} $(1)/usr/lib
$(CP) $(PKG_INSTALL_DIR)/usr/lib/libre.{a,so} $(1)/usr/lib
endef
define Package/libre/install
$(INSTALL_DIR) $(1)/usr/lib
$(CP) $(PKG_INSTALL_DIR)/usr/lib/libre.so.$(ABI_VERSION)* $(1)/usr/lib
$(CP) $(PKG_INSTALL_DIR)/usr/lib/libre.so $(1)/usr/lib
endef
$(eval $(call BuildPackage,libre))

View file

@ -1,6 +1,6 @@
--- a/src/dns/res.c
+++ b/src/dns/res.c
@@ -26,7 +26,7 @@ int get_resolv_dns(char *domain, size_t
@@ -25,7 +25,7 @@ int get_resolv_dns(char *domain, size_t
uint32_t i;
int ret, err;
@ -9,7 +9,7 @@
ret = res_init();
state = _res;
#else
@@ -76,7 +76,7 @@ int get_resolv_dns(char *domain, size_t
@@ -56,7 +56,7 @@ int get_resolv_dns(char *domain, size_t
*n = i;
out:

View file

@ -1,10 +1,10 @@
--- a/mk/re.mk
+++ b/mk/re.mk
@@ -47,7 +47,6 @@
@@ -43,7 +43,6 @@
ifneq ($(RELEASE),)
CFLAGS += -DRELEASE
-OPT_SPEED=1
endif
ifneq ($(TRACE_ERR),)

View file

@ -1,6 +1,6 @@
--- a/mk/re.mk
+++ b/mk/re.mk
@@ -412,11 +412,6 @@ endif
@@ -439,11 +439,6 @@ endif
CFLAGS += -DARCH=\"$(ARCH)\"

View file

@ -9,12 +9,12 @@
include $(TOPDIR)/rules.mk
PKG_NAME:=rem
PKG_VERSION:=1.0.0
PKG_RELEASE:=1
PKG_VERSION:=0.6.0
PKG_RELEASE:=2
PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.gz
PKG_SOURCE_URL:=https://codeload.github.com/baresip/rem/tar.gz/v$(PKG_VERSION)?
PKG_HASH:=bcc91bb521fae183357fb422b00a3981477a22e99d3afe165c4ec50a6bbed9da
PKG_SOURCE_URL:=http://www.creytiv.com/pub
PKG_HASH:=417620da3986461598aef327c782db87ec3dd02c534701e68f4c255e54e5272c
PKG_LICENSE:=BSD-3-Clause
PKG_LICENSE_FILES:=docs/COPYING
@ -31,7 +31,7 @@ define Package/librem
CATEGORY:=Libraries
DEPENDS:=+libre
TITLE:=Audio and video processing media library
URL:=https://github.com/baresip/rem
URL:=http://www.creytiv.com
endef
MAKE_FLAGS+= \

View file

@ -9,12 +9,12 @@ include $(TOPDIR)/rules.mk
PKG_NAME:=signalwire-client-c
PKG_VERSION:=2.0.0
PKG_VERSION:=1.3.0
PKG_RELEASE:=1
PKG_SOURCE:=signalwire-c-$(PKG_VERSION).tar.gz
PKG_SOURCE_URL:=https://codeload.github.com/signalwire/signalwire-c/tar.gz/v$(PKG_VERSION)?
PKG_HASH:=7916ad76b2c2c75ff616d19bf044894771b3f8602b80a6f74d8ba26206faef79
PKG_SOURCE_URL:=https://codeload.github.com/signalwire/signalwire-c/tar.gz/$(PKG_VERSION)?
PKG_HASH:=77bc7fbd8405283ef64ccbc22fba6687fc936ed76fafcc15e7e90290e2906884
PKG_BUILD_DIR:=$(BUILD_DIR)/signalwire-c-$(PKG_VERSION)
@ -29,41 +29,40 @@ PKG_MAINTAINER:=Sebastian Kemper <sebastian_ml@gmx.net>
include $(INCLUDE_DIR)/package.mk
include $(INCLUDE_DIR)/cmake.mk
define Package/signalwire-client-c
define Package/$(PKG_NAME)
SUBMENU:=Telephony
SECTION:=libs
CATEGORY:=Libraries
TITLE:=SignalWire C client library
URL:=https://github.com/signalwire/signalwire-c
ABI_VERSION:=2
ABI_VERSION:=1
DEPENDS:=+libatomic +libks +libopenssl
endef
# Otherwise OpenWrt's CPPFLAGS are ignored
TARGET_CFLAGS += $(TARGET_CPPFLAGS)
define Package/signalwire-client-c/install/headers
$(INSTALL_DIR) $(1)/usr/include/signalwire-client-c2/signalwire-client-c/$(2)
define Package/$(PKG_NAME)/install/headers
$(INSTALL_DIR) $(1)/usr/include/$(PKG_NAME)/$(2)
$(INSTALL_DATA) \
$(PKG_INSTALL_DIR)/usr/include/signalwire-client-c2/signalwire-client-c/$(2)/*.h \
$(1)/usr/include/signalwire-client-c2/signalwire-client-c/$(2)
$(PKG_INSTALL_DIR)/usr/include/$(PKG_NAME)/$(2)/*.h \
$(1)/usr/include/$(PKG_NAME)/$(2)
endef
define Build/InstallDev
$(foreach s,./ JSON blade signalwire transport,$(call Package/signalwire-client-c/install/headers,$(1),$(s));)
$(INSTALL_DIR) $(1)/usr/lib/pkgconfig \
$(1)/usr/include/signalwire-client-c2/signalwire-client-c/cmake
$(INSTALL_DATA) $(PKG_INSTALL_DIR)/usr/include/signalwire-client-c2/signalwire-client-c/cmake/* \
$(1)/usr/include/signalwire-client-c2/signalwire-client-c/cmake
$(CP) $(PKG_INSTALL_DIR)/usr/lib/libsignalwire_client2.so* $(1)/usr/lib
$(INSTALL_DATA) $(PKG_INSTALL_DIR)/usr/lib/pkgconfig/signalwire_client2.pc \
$(foreach s,./ JSON blade signalwire transport,$(call Package/$(PKG_NAME)/install/headers,$(1),$(s));)
$(INSTALL_DIR) $(1)/usr/lib/{cmake/$(PKG_NAME),pkgconfig}
$(INSTALL_DATA) $(PKG_INSTALL_DIR)/usr/include/$(PKG_NAME)/cmake/* \
$(1)/usr/lib/cmake/$(PKG_NAME)
$(CP) $(PKG_INSTALL_DIR)/usr/lib/libsignalwire_client.so* $(1)/usr/lib
$(INSTALL_DATA) $(PKG_INSTALL_DIR)/usr/lib/pkgconfig/signalwire_client.pc \
$(1)/usr/lib/pkgconfig
endef
define Package/signalwire-client-c/install
define Package/$(PKG_NAME)/install
$(INSTALL_DIR) $(1)/usr/lib
$(CP) $(PKG_INSTALL_DIR)/usr/lib/libsignalwire_client2.so.$(ABI_VERSION)* \
$(CP) $(PKG_INSTALL_DIR)/usr/lib/libsignalwire_client.so.$(ABI_VERSION)* \
$(1)/usr/lib
endef
$(eval $(call BuildPackage,signalwire-client-c))
$(eval $(call BuildPackage,$(PKG_NAME)))

View file

@ -0,0 +1,11 @@
--- a/cmake/FindLibKS.cmake
+++ b/cmake/FindLibKS.cmake
@@ -19,7 +19,7 @@ if (NOT TARGET ks)
endif()
# From here we can bootstrap into cmake stuff
- set(LIBKS_CMAKE_DIR ${LIBKS_INCLUDE_DIRS}/cmake)
+ set(LIBKS_CMAKE_DIR ${LIBKS_LIBRARY_DIRS}/cmake/libks)
# Load ks utils for our build macros
include(${LIBKS_CMAKE_DIR}/ksutil.cmake)

View file

@ -9,12 +9,12 @@ include $(TOPDIR)/rules.mk
PKG_NAME:=sofia-sip
PKG_VERSION:=1.13.17
PKG_RELEASE:=1
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:=daca3d961b6aa2974ad5d3be69ed011726c3e4d511b2a0d4cb6d878821a2de7a
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=2023-06-16
PKG_SOURCE_VERSION:=0d2e6ac65e0e8f53d652665a743015a88bf048d4
PKG_SOURCE_DATE=2020-10-19
PKG_SOURCE_VERSION:=e08c74db3f072db893c4d37de733f03c27bf7ed3
PKG_RELEASE:=1
PKG_MIRROR_HASH:=2d25c0f73f15aab37af7f09cf84f379b3fafb7c4d4e867ed1643dd3b3f594920
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:=503dba87d726854b74b49e70679e64e6e86d5812
PKG_SOURCE_DATE=2022-11-04
PKG_SOURCE_VERSION:=3d046f7d6842298c6838b5ce5b51d495d383b158
PKG_SOURCE_DATE=2021-10-06
PKG_RELEASE:=1
PKG_MIRROR_HASH:=0d585c108ec18d136ce03704b96d0a6769e617c820fc74f735e3e192ad282611
PKG_MIRROR_HASH:=d485c89a7230ab8c318eed6c3a954b154d7e53cc7a0194abf96f4dcb83e6909c
PKG_FIXUP:=autoreconf
@ -43,13 +43,8 @@ endef
CONFIGURE_ARGS+= \
--with-asterisk=$(STAGING_DIR)/usr/include \
--with-astversion=18
ifeq ($(CONFIG_BUILD_NLS),y)
CONFIGURE_ARGS+=--with-iconv=$(ICONV_PREFIX)/include
else
CONFIGURE_ARGS+=--with-iconv=$(TOOLCHAIN_DIR)/include
endif
--with-astversion=18 \
--with-iconv=$(ICONV_PREFIX)/include
MAKE_FLAGS+=LD="$(TARGET_CC)"
@ -84,14 +79,4 @@ fi
exit 0
endef
define Build/Prepare
$(call Build/Prepare/Default)
ifeq ($(QUILT),)
ifeq ($(CONFIG_BUILD_NLS),y)
$(SED) 's/\[iconv\], \[c iconv\]/[libiconv], [iconv]/' \
"$(PKG_BUILD_DIR)/configure.ac"
endif
endif
endef
$(eval $(call BuildPackage,asterisk-chan-dongle))

View file

@ -0,0 +1,11 @@
--- a/configure.ac
+++ b/configure.ac
@@ -90,7 +90,7 @@ fi
dnl Checks for libraries.
dnl AC_CHECK_LIB([pthread], [pthread_create]) # should use ast_pthread_join everywhere?
-AC_SEARCH_LIBS([iconv], [c iconv],,AC_MSG_ERROR([iconv library missing]))
+AC_SEARCH_LIBS([libiconv], [iconv],,AC_MSG_ERROR([iconv library missing]))
AC_CHECK_LIB([sqlite3], [sqlite3_open],,AC_MSG_ERROR([sqlite3 library missing]))
dnl Checks for header files.

View file

@ -1,6 +1,6 @@
--- a/configure.ac
+++ b/configure.ac
@@ -247,8 +247,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 -g3"
AC_DEFINE([__DEBUG__], [1], [Build with debugging])

View file

@ -1,16 +0,0 @@
--- a/configure.ac
+++ b/configure.ac
@@ -165,11 +165,13 @@ dnl AC_CHECK_TYPE(uint64_t, unsigned lon
AC_CHECK_SIZEOF(int)
AC_CHECK_SIZEOF(long int)
+AC_CHECK_SIZEOF(long long int)
AC_CHECK_SIZEOF(time_t)
case "$ac_cv_sizeof_time_t" in
''|0) AC_MSG_ERROR([Could not find time_t type]);;
$ac_cv_sizeof_int) AC_DEFINE([PRI_time_t], ["d"], [printf format for time_t]);;
$ac_cv_sizeof_long_int) AC_DEFINE([PRI_time_t], ["ld"], [printf format for time_t]);;
+$ac_cv_sizeof_long_long_int) AC_DEFINE([PRI_time_t], ["lld"], [printf format for time_t]);;
*) AC_MSG_ERROR([Could not find match size of time_t to printf format])
esac

View file

@ -31,7 +31,6 @@ define Package/$(PKG_NAME)
TITLE:=Lantiq channel driver
URL:=https://github.com/kochstefan/asterisk_channel_lantiq
DEPENDS:=+asterisk +kmod-ltq-vmmc
USERID:=asterisk=385::vmmc=386
endef
define Package/$(PKG_NAME)/description

View file

@ -9,7 +9,7 @@
include $(TOPDIR)/rules.mk
PKG_NAME:=asterisk-chan-sccp
PKG_RELEASE:=2
PKG_RELEASE:=1
# Updated to v4.3.3 release
PKG_SOURCE_URL:=https://github.com/chan-sccp/chan-sccp.git
@ -26,9 +26,6 @@ PKG_MAINTAINER:=Jiri Slachta <jiri@slachta.eu>
PKG_INSTALL:=1
# need iconv.m4, otherwise error during autoreconf
PKG_BUILD_DEPENDS:=gettext-full
include $(INCLUDE_DIR)/package.mk
# chan-sccp needs iconv
include $(INCLUDE_DIR)/nls.mk

View file

@ -1,6 +1,6 @@
--- a/autoconf/extra.m4
+++ b/autoconf/extra.m4
@@ -516,17 +516,6 @@ AC_DEFUN([CS_ENABLE_OPTIMIZATION], [
@@ -491,17 +491,6 @@ AC_DEFUN([CS_ENABLE_OPTIMIZATION], [
], SUPPORTED_CFLAGS)
])
AC_SUBST([strip_binaries])
@ -16,5 +16,5 @@
- esac
- CFLAGS_saved="${CFLAGS_saved} ${optimize_flag} "
])
AS_IF([test "X${enable_debug}" == "Xyes"], [

View file

@ -1,11 +0,0 @@
--- a/autoconf/acinclude.m4
+++ b/autoconf/acinclude.m4
@@ -497,7 +497,7 @@ AC_DEFUN([CS_GET_VERSION], [
SCCP_REVISION="unknown"
CURRENT=`pwd`
- BASE=`dirname $ac_dir`
+ BASE=`dirname $ac_aux_dir`
cd $BASE >/dev/null
. ./tools/versioncheck silent
cd $CURRENT >/dev/null

View file

@ -1,6 +1,8 @@
--- a/src/chan_sccp.c
+++ b/src/chan_sccp.c
@@ -198,7 +198,7 @@ boolean_t sccp_postPBX_load(void)
Index: chan-sccp-v4.3.0-20171123/src/chan_sccp.c
===================================================================
--- chan-sccp-v4.3.0-20171123.orig/src/chan_sccp.c
+++ chan-sccp-v4.3.0-20171123/src/chan_sccp.c
@@ -186,7 +186,7 @@ boolean_t sccp_postPBX_load(void)
#else
snprintf(SCCP_REVISIONSTR, sizeof(SCCP_REVISIONSTR), "%s", SCCP_REVISION);
#endif

View file

@ -8,12 +8,12 @@
include $(TOPDIR)/rules.mk
PKG_NAME:=asterisk-opus
PKG_RELEASE:=2
PKG_RELEASE:=1
PKG_SOURCE_URL:=https://github.com/traud/asterisk-opus.git
PKG_SOURCE_DATE:=2021-11-01
PKG_SOURCE_VERSION:=20522fbcd3fdf6f0adb20602d096d14cd69055e8
PKG_MIRROR_HASH:=e14dc42b0e5f4720e3f028e0b426f4e660bf315a103a015820ca3697e1fe9985
PKG_SOURCE_DATE:=2017-10-09
PKG_SOURCE_VERSION:=83e1b458c77e0e287adeca494eeb79edb077b0ff
PKG_MIRROR_HASH:=c71b859db7518cdafff1650e629c5901b290fe68f8af54ef1afd57bc9f15b122
PKG_SOURCE_PROTO:=git
PKG_LICENSE:=GPL-2.0
@ -23,21 +23,18 @@ PKG_MAINTAINER:=Jiri Slachta <jiri@slachta.eu>
include $(INCLUDE_DIR)/package.mk
TARGET_CFLAGS += \
-DAST_MODULE_SELF_SYM=__internal_codec_opus_open_source_self \
$(FPIC)
define Package/asterisk-opus/Default
define Package/asterisk-codec-opus
SUBMENU:=Telephony
SECTION:=net
CATEGORY:=Network
TITLE:=Opus codec support
URL:=https://github.com/traud/asterisk-opus
DEPENDS:=asterisk +libopus
endef
define Package/asterisk-codec-opus
$(call Package/asterisk-opus/Default)
TITLE:=Opus codec support
endef
define Package/asterisk-codec-opus/description
Opus is the default audio codec in WebRTC. WebRTC is available in
Asterisk via SIP over WebSockets (WSS). Nevertheless, Opus can be used
@ -58,24 +55,7 @@ define Package/asterisk-codec-opus/install
$(1)/usr/lib/asterisk/modules
endef
define Package/asterisk-format-ogg-opus
$(call Package/asterisk-opus/Default)
TITLE:=OGG/Opus audio support
DEPENDS+=+libopusfile +libopusenc
endef
define Package/asterisk-format-ogg-opus/description
Reading and writing audio files in the OGG/Opus format.
endef
define Package/asterisk-format-ogg-opus/install
$(INSTALL_DIR) $(1)/usr/lib/asterisk/modules
$(INSTALL_BIN) $(PKG_BUILD_DIR)/formats/format_ogg_opus_open_source.so \
$(1)/usr/lib/asterisk/modules
endef
define Build/Configure
endef
$(eval $(call BuildPackage,asterisk-codec-opus))
$(eval $(call BuildPackage,asterisk-format-ogg-opus))

View file

@ -1,35 +1,23 @@
--- a/Makefile
+++ b/Makefile
@@ -5,18 +5,18 @@ libdir=$(exec_prefix)/lib
# build with `make OPUSENC=0` to disable rewrite support using libopusenc
OPUSENC?=1
@@ -3,17 +3,17 @@ exec_prefix=$(prefix)
libdir=$(exec_prefix)/lib
-CFLAGS=-pthread -D_FORTIFY_SOURCE=2 -fPIC
-DEBUG=-g3
-OPTIMIZE=-O3
+CFLAGS+=-Wall -pthread
+DEBUG=
+OPTIMIZE=
CC=gcc
-CFLAGS=-pthread -g3 -O3 -D_FORTIFY_SOURCE=2 -fPIC
+CFLAGS+=-pthread
CPPFLAGS=
DEFS=
INSTALL=/usr/bin/install -c
-LDFLAGS=-pthread -Wl,--warn-common
+LDFLAGS+=-pthread -Wl,--warn-common
-LDFLAGS=-shared -pthread -Wl,--warn-common
+LDFLAGS+=-shared -pthread -Wl,--warn-common
LIBS=
MKDIR_P=/bin/mkdir -p
SHELL=/bin/sh
ASTMODDIR=$(libdir)/asterisk/modules
-MODULES=codec_opus_open_source format_ogg_opus_open_source format_vp8 res_format_attr_opus
+MODULES=codec_opus_open_source format_ogg_opus_open_source
+MODULES=codec_opus_open_source
.SUFFIXES: .c .so
@@ -38,7 +38,7 @@ codec_opus_open_source: DEFS+=-DAST_MODU
-DAST_MODULE_SELF_SYM=__internal_codec_opus_open_source_self
codec_opus_open_source: codecs/codec_opus_open_source.so
-format_ogg_opus_open_source: CPATH+=-I/usr/include/opus
+format_ogg_opus_open_source: CPATH+=-I$(STAGING_DIR)/usr/include/opus
format_ogg_opus_open_source: LIBS+=-lopus -lopusfile
format_ogg_opus_open_source: DEFS+=-DAST_MODULE=\"format_ogg_opus_open_source\" \
-DAST_MODULE_SELF_SYM=__internal_format_ogg_opus_open_source_self

View file

@ -8,13 +8,12 @@
include $(TOPDIR)/rules.mk
PKG_NAME:=asterisk
PKG_VERSION:=20.8.1
PKG_VERSION:=18.11.2
PKG_RELEASE:=1
PKG_CPE_ID:=cpe:/a:digium:asterisk
PKG_SOURCE:=asterisk-$(PKG_VERSION).tar.gz
PKG_SOURCE_URL:=https://downloads.asterisk.org/pub/telephony/asterisk/releases
PKG_HASH:=fa498b6224e8c262de6840a67e00e3747e178fcefd9fb2595885d402ca3248f5
PKG_HASH:=b456d19610e53789446e097bb9773a82a04088922de0cfaff2b818326b67296b
PKG_BUILD_DEPENDS:=libxml2/host
@ -48,13 +47,13 @@ MODULES_AVAILABLE:= \
app-blind-transfer \
app-bridgeaddchan \
app-bridgewait \
app-broadcast \
app-celgenuserevent \
app-chanisavail \
app-channelredirect \
app-chanspy \
app-confbridge \
app-controlplayback \
app-dahdiras \
app-dictate \
app-directed-pickup \
app-directory \
@ -67,7 +66,8 @@ MODULES_AVAILABLE:= \
app-flash \
app-followme \
app-getcpeid \
app-if \
app-ices \
app-image \
app-ivrdemo \
app-mf \
app-milliwatt \
@ -89,7 +89,6 @@ MODULES_AVAILABLE:= \
app-senddtmf \
app-sendtext \
app-sf \
app-signal \
app-skel \
app-sms \
app-softhangup \
@ -102,6 +101,7 @@ MODULES_AVAILABLE:= \
app-talkdetect \
app-test \
app-transfer \
app-url \
app-userevent \
app-verbose \
app-waitforcond \
@ -135,6 +135,7 @@ MODULES_AVAILABLE:= \
chan-mobile \
chan-motif \
chan-ooh323 \
chan-oss \
chan-rtp \
chan-sip \
chan-skinny \
@ -183,8 +184,6 @@ MODULES_AVAILABLE:= \
func-dialplan \
func-enum \
func-env \
func-evalexten \
func-export \
func-extstate \
func-frame-drop \
func-frame-trace \
@ -228,7 +227,6 @@ MODULES_AVAILABLE:= \
pgsql \
pjsip \
res-adsi \
res-aeap \
res-ael-share \
res-agi \
res-ari \
@ -252,7 +250,6 @@ MODULES_AVAILABLE:= \
res-calendar-icalendar \
res-chan-stats \
res-clialiases \
res-cliexec \
res-clioriginate \
res-config-ldap \
res-config-mysql \
@ -274,7 +271,6 @@ MODULES_AVAILABLE:= \
res-format-attr-siren14 \
res-format-attr-siren7 \
res-format-attr-vp8 \
res-geolocation \
res-http-media-cache \
res-http-websocket \
res-limit \
@ -288,10 +284,7 @@ MODULES_AVAILABLE:= \
res-mwi-external-ami \
res-parking \
res-phoneprov \
res-pjsip-aoc \
res-pjsip-geolocation \
res-pjsip-phoneprov \
res-pjsip-rfc3329 \
res-pjsip-stir-shaken \
res-pjproject \
res-pktccops \
@ -307,7 +300,6 @@ MODULES_AVAILABLE:= \
res-sorcery \
res-sorcery-memory-cache \
res-speech \
res-speech-aeap \
res-srtp \
res-stasis \
res-stasis-answer \
@ -331,6 +323,8 @@ UTILS_AVAILABLE:= \
astdb2bdb \
check_expr \
check_expr2 \
conf2ael \
muted \
smsq \
stereorize \
streamplayer
@ -340,9 +334,9 @@ AST_ENABLE:=
PKG_CONFIG_DEPENDS:= \
$(patsubst %,CONFIG_PACKAGE_$(PKG_NAME)-%,$(MODULES_AVAILABLE)) \
$(patsubst %,CONFIG_PACKAGE_$(PKG_NAME)-util-%,$(subst _,-,$(UTILS_AVAILABLE))) \
CONFIG_ASTERISK_LIBXSLT_SUPPORT \
CONFIG_ASTERISK_LOW_MEMORY
include $(INCLUDE_DIR)/uclibc++.mk
include $(INCLUDE_DIR)/package.mk
include $(INCLUDE_DIR)/host-build.mk
# Needed for res-config-mysql and func-iconv to find iconv
@ -382,13 +376,6 @@ define Package/$(PKG_NAME)/config
menu "Advanced configuration"
depends on PACKAGE_asterisk
config ASTERISK_LIBXSLT_SUPPORT
bool "Link Asterisk against libxslt"
default y if x86_64
help
Build Asterisk with libxslt support. This is required for
res-geolocation.
config ASTERISK_LOW_MEMORY
bool "Optimize Asterisk for low memory usage"
default n
@ -471,7 +458,7 @@ define Package/$(PKG_NAME)
$(call Package/$(PKG_NAME)/Default)
TITLE:=Complete open source PBX, v$(PKG_VERSION)
MENU:=1
DEPENDS:=+ASTERISK_LIBXSLT_SUPPORT:libxslt +libstdcpp +jansson +libcap +libedit +libopenssl +libsqlite3 +libuuid +libxml2 +zlib
DEPENDS:=$(CXX_DEPENDS) +jansson +libcap +libedit +libopenssl +libsqlite3 +libuuid +libxml2 +zlib
USERID:=asterisk=385:asterisk=385
endef
@ -581,11 +568,13 @@ CONFIGURE_ARGS+= \
--with-gsm=internal \
--without-gtk2 \
--with-ilbc=internal \
--without-isdnnet \
--without-misdn \
--without-nbs \
--without-pjproject-bundled \
--with-libedit="$(STAGING_DIR)/usr" \
$(if $(CONFIG_PACKAGE_$(PKG_NAME)-res-stir-shaken),--with-libjwt-bundled=yes,--with-libjwt-bundled=no) \
--with-libxml2 \
$(if $(CONFIG_ASTERISK_LIBXSLT_SUPPORT),--with-libxslt,--without-libxslt) \
--without-libxslt \
$(if $(CONFIG_PACKAGE_$(PKG_NAME)-res-snmp),--with-netsnmp="$(STAGING_DIR)/usr",--without-netsnmp) \
--without-newt \
--without-osptk \
@ -596,12 +585,15 @@ CONFIGURE_ARGS+= \
--without-radius \
$(if $(CONFIG_PACKAGE_$(PKG_NAME)-res-fax-spandsp),--with-spandsp="$(STAGING_DIR)/usr",--without-spandsp) \
--without-sdl \
--without-sqlite \
--with-sqlite3="$(STAGING_DIR)/usr" \
--without-suppserv \
--without-tds \
$(if $(CONFIG_PACKAGE_$(PKG_NAME)-res-resolver-unbound),--with-unbound="$(STAGING_DIR)/usr",--without-unbound) \
$(if $(CONFIG_PACKAGE_$(PKG_NAME)-format-ogg-vorbis),--with-vorbis="$(STAGING_DIR)/usr",--without-vorbis) \
$(if $(CONFIG_PACKAGE_$(PKG_NAME)-app-voicemail-imap),--with-imap=system,--without-imap) \
--without-uriparser \
--without-vpb \
--with-z="$(STAGING_DIR)/usr"
ifeq ($(CONFIG_PACKAGE_$(PKG_NAME)-codec-speex)$(CONFIG_PACKAGE_$(PKG_NAME)-format-ogg-speex)$(CONFIG_PACKAGE_$(PKG_NAME)-func-speex),)
@ -628,7 +620,7 @@ CONFIGURE_ARGS+= \
--with-ogg="$(STAGING_DIR)/usr"
endif
ifeq ($(CONFIG_PACKAGE_$(PKG_NAME)-res-srtp),)
ifeq ($(CONFIG_PACKAGE_$(PKG_NAME)-res-pjproject)$(CONFIG_PACKAGE_$(PKG_NAME)-res-srtp),)
CONFIGURE_ARGS+= \
--without-srtp
else
@ -789,13 +781,13 @@ $(eval $(call BuildAsteriskModule,app-authenticate,Authenticate commands,Authent
$(eval $(call BuildAsteriskModule,app-blind-transfer,Blind transfer,Redirects all channels currently bridged to the caller channel to a specified destination.,,,app_blind_transfer,,))
$(eval $(call BuildAsteriskModule,app-bridgeaddchan,Bridge add channel,Bridge-add-channel application.,,,app_bridgeaddchan,,))
$(eval $(call BuildAsteriskModule,app-bridgewait,Holding bridge,Application to place a channel into a holding bridge.,+$(PKG_NAME)-bridge-holding,,app_bridgewait,,))
$(eval $(call BuildAsteriskModule,app-broadcast,Channel audio broadcasting,Channel Audio Broadcasting.,,,app_broadcast,,))
$(eval $(call BuildAsteriskModule,app-celgenuserevent,User-defined CEL event,Generate a user defined CEL event.,,,app_celgenuserevent,,))
$(eval $(call BuildAsteriskModule,app-chanisavail,Channel availability check,Check channel availability.,,,app_chanisavail,,))
$(eval $(call BuildAsteriskModule,app-channelredirect,Redirect a channel,Redirects a given channel to a dialplan target.,,,app_channelredirect,,))
$(eval $(call BuildAsteriskModule,app-chanspy,Channel listen in,Listen to the audio of an active channel.,,,app_chanspy,,))
$(eval $(call BuildAsteriskModule,app-confbridge,ConfBridge,Conference bridge application.,+$(PKG_NAME)-bridge-builtin-features +$(PKG_NAME)-bridge-simple +$(PKG_NAME)-bridge-softmix,confbridge.conf,app_confbridge,,))
$(eval $(call BuildAsteriskModule,app-controlplayback,Control playback,Control playback application.,,,app_controlplayback,,))
$(eval $(call BuildAsteriskModule,app-dahdiras,Execute an ISDN RAS,DAHDI ISDN Remote Access Server.,+$(PKG_NAME)-chan-dahdi,,app_dahdiras,,))
$(eval $(call BuildAsteriskModule,app-dictate,Virtual dictation machine,Virtual dictation machine.,,,app_dictate,,))
$(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,,))
@ -808,7 +800,8 @@ $(eval $(call BuildAsteriskModule,app-festival,Simple festival interface,Simple
$(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.,+asterisk-res-adsi,,app_getcpeid,,))
$(eval $(call BuildAsteriskModule,app-if,If branch and conditional execution,If Branch and Conditional Execution.,,,app_if,,))
$(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,,))
@ -830,7 +823,6 @@ $(eval $(call BuildAsteriskModule,app-sayunixtime,Say Unix time,Say time.,,,app_
$(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-signal,Channel signaling,Channel Signaling Applications.,,,app_signal,,))
$(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,,))
@ -843,6 +835,7 @@ $(eval $(call BuildAsteriskModule,app-system,System exec,Generic system applicat
$(eval $(call BuildAsteriskModule,app-talkdetect,File playback with audio detect,Playback with talk detection.,,,app_talkdetect,,))
$(eval $(call BuildAsteriskModule,app-test,Interface test,Interface test application.,,,app_test,,))
$(eval $(call BuildAsteriskModule,app-transfer,Transfers caller to other ext,Transfers a caller to another extension.,,,app_transfer,,))
$(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,,))
@ -860,7 +853,7 @@ $(eval $(call BuildAsteriskModule,bridge-holding,Bridging for storing channels i
$(eval $(call BuildAsteriskModule,bridge-native-rtp,Native RTP bridging technology module,Native RTP bridging module.,,,bridge_native_rtp,,))
$(eval $(call BuildAsteriskModule,bridge-simple,Simple two channel bridging module,Simple two channel bridging module.,,,bridge_simple,,))
$(eval $(call BuildAsteriskModule,bridge-softmix,Multi-party software based channel mixing,Multi-party software based channel mixing.,,,bridge_softmix,,))
$(eval $(call BuildAsteriskModule,cdr,Provides CDR,Call Detail Records.,,cdr.conf cdr_custom.conf cdr_manager.conf,app_cdr app_forkcdr cdr_custom cdr_manager func_cdr,,))
$(eval $(call BuildAsteriskModule,cdr,Provides CDR,Call Detail Records.,,cdr.conf cdr_custom.conf cdr_manager.conf cdr_syslog.conf,app_cdr app_forkcdr cdr_custom cdr_manager cdr_syslog func_cdr,,))
$(eval $(call BuildAsteriskModule,cdr-csv,Provides CDR CSV,Comma Separated Values CDR backend.,,,cdr_csv,,))
$(eval $(call BuildAsteriskModule,cdr-sqlite3,Provides CDR SQLITE3,SQLite3 CDR backend.,libsqlite3,,cdr_sqlite3_custom,,))
$(eval $(call BuildAsteriskModule,cel-custom,Customizable CSV CEL backend,Customizable Comma Separated Values CEL backend.,,cel_custom.conf,cel_custom,,))
@ -876,6 +869,7 @@ $(eval $(call BuildAsteriskModule,chan-mgcp,MGCP,Media Gateway Control Protocol.
$(eval $(call BuildAsteriskModule,chan-mobile,Bluetooth channel,Bluetooth mobile device channel driver.,+bluez-libs,chan_mobile.conf,chan_mobile,,))
$(eval $(call BuildAsteriskModule,chan-motif,Jingle channel,Motif Jingle channel driver.,+$(PKG_NAME)-res-xmpp,motif.conf,chan_motif,,))
$(eval $(call BuildAsteriskModule,chan-ooh323,H.323 channel,Objective Systems H.323 channel.,,ooh323.conf,chan_ooh323,,))
$(eval $(call BuildAsteriskModule,chan-oss,OSS channel,OSS console channel driver.,,oss.conf,chan_oss,,))
$(eval $(call BuildAsteriskModule,chan-rtp,RTP media channel,RTP media channel.,+asterisk-res-rtp-multicast,,chan_rtp,,))
$(eval $(call BuildAsteriskModule,chan-sip,SIP channel,Session Initiation Protocol.,+$(PKG_NAME)-app-confbridge,sip.conf sip_notify.conf,chan_sip,,))
$(eval $(call BuildAsteriskModule,chan-skinny,Skinny channel,Skinny Client Control Protocol.,,skinny.conf,chan_skinny,,))
@ -892,7 +886,7 @@ $(eval $(call BuildAsteriskModule,codec-lpc10,Linear to LPC10 translation,LPC10
$(eval $(call BuildAsteriskModule,codec-resample,resample sLinear audio,SLIN resampling codec.,,,codec_resample,,))
$(eval $(call BuildAsteriskModule,codec-speex,Speex Coder/Decoder,Speex coder/decoder.,@!SOFT_FLOAT +libspeex +libspeexdsp,,codec_speex,,))
$(eval $(call BuildAsteriskModule,codec-ulaw,Signed linear to ulaw translation,Ulaw coder/decoder.,,,codec_ulaw,,))
$(eval $(call BuildAsteriskModule,curl,CURL,cURL,+libcurl,,func_curl res_config_curl res_curl,,))
$(eval $(call BuildAsteriskModule,curl,CURL,cURL support,+libcurl,,func_curl res_config_curl res_curl,,))
$(eval $(call BuildAsteriskModule,format-g719,G.719,ITU G.719.,,,format_g719,,))
$(eval $(call BuildAsteriskModule,format-g723,G.723.1,G.723.1 simple timestamp file format.,,,format_g723,,))
$(eval $(call BuildAsteriskModule,format-g726,G.726,Raw G.726 data.,,,format_g726,,))
@ -912,7 +906,7 @@ $(eval $(call BuildAsteriskModule,format-vox,VOX format,Dialogic VOX file format
$(eval $(call BuildAsteriskModule,format-wav,WAV format (8000hz Signed Linear),Microsoft WAV/WAV16 format.,,,format_wav,,))
$(eval $(call BuildAsteriskModule,format-wav-gsm,WAV format (Proprietary GSM),Microsoft WAV format.,,,format_wav_gsm,,))
$(eval $(call BuildAsteriskModule,func-aes,AES dialplan functions,AES dialplan functions.,,,func_aes,,))
$(eval $(call BuildAsteriskModule,func-base64,base64,Base64 encode/decode dialplan functions.,,,func_base64,,))
$(eval $(call BuildAsteriskModule,func-base64,base64 support,Base64 encode/decode dialplan functions.,,,func_base64,,))
$(eval $(call BuildAsteriskModule,func-blacklist,Blacklist on callerid,Look up Caller ID name/number from blacklist database.,,,func_blacklist,,))
$(eval $(call BuildAsteriskModule,func-callcompletion,Call control configuration function,Call control configuration function.,,,func_callcompletion,,))
$(eval $(call BuildAsteriskModule,func-channel,Channel info,Channel information dialplan functions.,,,func_channel,,))
@ -924,8 +918,6 @@ $(eval $(call BuildAsteriskModule,func-dialgroup,Dialgroup dialplan function,Dia
$(eval $(call BuildAsteriskModule,func-dialplan,Dialplan context/extension/priority checking functions,Dialplan context/extension/priority checking functions.,,,func_dialplan,,))
$(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-evalexten,Extension evaluation,Extension evaluation functions.,,,func_evalexten,,))
$(eval $(call BuildAsteriskModule,func-export,Export function,Set variables and functions on other channels.,,,func_export,,))
$(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,,))
@ -969,7 +961,6 @@ $(eval $(call BuildAsteriskModule,pbx-spool,Call Spool,Outgoing spool support.,,
$(eval $(call BuildAsteriskModule,pgsql,PostgreSQL,PostgreSQL support.,+libpq,cel_pgsql.conf cdr_pgsql.conf res_pgsql.conf,cel_pgsql cdr_pgsql res_config_pgsql,,))
$(eval $(call BuildAsteriskModule,pjsip,pjsip channel,PJSIP SIP stack.,+$(PKG_NAME)-res-http-websocket +$(PKG_NAME)-res-pjproject +$(PKG_NAME)-res-sorcery +libpjsip +libpjmedia +libpjnath +libpjsip-simple +libpjsip-ua +libpjsua +libpjsua2,pjsip.conf pjsip_notify.conf pjsip_wizard.conf,chan_pjsip func_pjsip_aor func_pjsip_contact func_pjsip_endpoint res_pjsip res_pjsip_acl res_pjsip_authenticator_digest res_pjsip_caller_id res_pjsip_config_wizard res_pjsip_dialog_info_body_generator res_pjsip_diversion res_pjsip_dlg_options res_pjsip_dtmf_info res_pjsip_empty_info res_pjsip_endpoint_identifier_anonymous res_pjsip_endpoint_identifier_ip res_pjsip_endpoint_identifier_user res_pjsip_exten_state res_pjsip_header_funcs res_pjsip_history res_pjsip_logger res_pjsip_messaging res_pjsip_mwi res_pjsip_mwi_body_generator res_pjsip_nat res_pjsip_notify res_pjsip_one_touch_record_info res_pjsip_outbound_authenticator_digest res_pjsip_outbound_publish res_pjsip_outbound_registration res_pjsip_path res_pjsip_pidf_body_generator res_pjsip_pidf_digium_body_supplement res_pjsip_pidf_eyebeam_body_supplement res_pjsip_publish_asterisk res_pjsip_pubsub res_pjsip_refer res_pjsip_registrar res_pjsip_rfc3326 res_pjsip_sdp_rtp res_pjsip_send_to_voicemail res_pjsip_session res_pjsip_sips_contact res_pjsip_t38 res_pjsip_transport_websocket res_pjsip_xpidf_body_generator,,))
$(eval $(call BuildAsteriskModule,res-adsi,Provide ADSI,ADSI resource.,,,res_adsi,,))
$(eval $(call BuildAsteriskModule,res-aeap,Provide AEAP,AEAP resource.,+asterisk-res-http-websocket,aeap.conf,res_aeap,,))
$(eval $(call BuildAsteriskModule,res-ael-share,Shareable AEL code,Shareable code for AEL.,,,res_ael_share,,))
$(eval $(call BuildAsteriskModule,res-agi,Asterisk Gateway Interface,Asterisk Gateway Interface.,+$(PKG_NAME)-res-speech,,res_agi,,))
$(eval $(call BuildAsteriskModule,res-ari,Asterisk RESTful interface,Asterisk RESTful Interface.,+$(PKG_NAME)-res-http-websocket,ari.conf,res_ari,,))
@ -993,7 +984,6 @@ $(eval $(call BuildAsteriskModule,res-calendar-exchange,Exchange calendar,Asteri
$(eval $(call BuildAsteriskModule,res-calendar-icalendar,iCalendar calendar,Asterisk iCalendar .ics file integration.,+$(PKG_NAME)-res-calendar +libical +libneon,,res_calendar_icalendar,,))
$(eval $(call BuildAsteriskModule,res-chan-stats,statsd channel stats,Example of how to use Stasis.,+$(PKG_NAME)-res-statsd,,res_chan_stats,,))
$(eval $(call BuildAsteriskModule,res-clialiases,CLI aliases,CLI aliases.,,cli_aliases.conf,res_clialiases,,))
$(eval $(call BuildAsteriskModule,res-cliexec,Execute from CLI,Simple dialplan execution from the CLI.,,,res_cliexec,,))
$(eval $(call BuildAsteriskModule,res-clioriginate,Calls via CLI,Call origination and redirection from the CLI.,,,res_clioriginate,,))
$(eval $(call BuildAsteriskModule,res-config-ldap,LDAP realtime interface,LDAP realtime interface.,+libopenldap,res_ldap.conf,res_config_ldap,,))
$(eval $(call BuildAsteriskModule,res-config-mysql,MySQL CDR backend,MySQL realtime configuration driver.,+libmysqlclient,,res_config_mysql,,))
@ -1015,9 +1005,8 @@ $(eval $(call BuildAsteriskModule,res-format-attr-silk,SILK format attribute mod
$(eval $(call BuildAsteriskModule,res-format-attr-siren14,Siren14 format attribute module,Siren14 format attribute module.,,,res_format_attr_siren14,,))
$(eval $(call BuildAsteriskModule,res-format-attr-siren7,Siren7 format attribute module,Siren7 format attribute module.,,,res_format_attr_siren7,,))
$(eval $(call BuildAsteriskModule,res-format-attr-vp8,VP8 format attribute module,VP8 format attribute module.,,,res_format_attr_vp8,,))
$(eval $(call BuildAsteriskModule,res-geolocation,Geolocation,Geolocation support.,@ASTERISK_LIBXSLT_SUPPORT,geolocation.conf,res_geolocation,,))
$(eval $(call BuildAsteriskModule,res-http-media-cache,HTTP media cache backend,HTTP media cache backend.,+$(PKG_NAME)-curl,res_http_media_cache.conf,res_http_media_cache,,))
$(eval $(call BuildAsteriskModule,res-http-websocket,HTTP websocket,HTTP WebSocket support.,,,res_http_websocket,,))
$(eval $(call BuildAsteriskModule,res-http-media-cache,HTTP media cache backend,HTTP media cache backend.,+$(PKG_NAME)-curl,,res_http_media_cache,,))
$(eval $(call BuildAsteriskModule,res-http-websocket,HTTP websocket support,HTTP WebSocket support.,,,res_http_websocket,,))
$(eval $(call BuildAsteriskModule,res-limit,Resource limits,Resource limits.,,,res_limit,,))
$(eval $(call BuildAsteriskModule,res-manager-devicestate,Device state topic forwarder,Manager device state topic forwarder.,,,res_manager_devicestate,,))
$(eval $(call BuildAsteriskModule,res-manager-presencestate,Presence state topic forwarder,Manager presence state topic forwarder.,,,res_manager_presencestate,,))
@ -1029,12 +1018,9 @@ $(eval $(call BuildAsteriskModule,res-mwi-external,Core external MWI resource,Co
$(eval $(call BuildAsteriskModule,res-mwi-external-ami,AMI for external MWI,AMI support for external MWI.,+$(PKG_NAME)-res-mwi-external,,res_mwi_external_ami,,))
$(eval $(call BuildAsteriskModule,res-parking,Phone Parking,Call parking resource.,+$(PKG_NAME)-bridge-holding,res_parking.conf,res_parking,,))
$(eval $(call BuildAsteriskModule,res-phoneprov,Phone Provisioning,HTTP phone provisioning.,,phoneprov.conf,res_phoneprov,,))
$(eval $(call BuildAsteriskModule,res-pjsip-aoc,PJSIP AOC,PJSIP AOC Support.,+asterisk-pjsip +asterisk-res-pjproject,,res_pjsip_aoc,,))
$(eval $(call BuildAsteriskModule,res-pjsip-geolocation,PJSIP Geolocation,PJSIP Geolocation support.,+asterisk-pjsip +asterisk-res-geolocation,,res_pjsip_geolocation,,))
$(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-rfc3329,PJSIP RFC3329,PJSIP RFC3329 Support (partial).,+asterisk-pjsip +asterisk-res-pjproject,,res_pjsip_rfc3329,,))
$(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.,+asterisk-res-sorcery +libpj +libpjlib-util +libpjmedia +libpjmedia +libpjnath +libpjsip-simple +libpjsip-ua +libpjsip +libpjsua +libpjsua2,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,,))
@ -1048,7 +1034,6 @@ $(eval $(call BuildAsteriskModule,res-snmp,SNMP [Sub]Agent for Asterisk,SNMP age
$(eval $(call BuildAsteriskModule,res-sorcery,Sorcery data layer,Sorcery backend modules for data access intended for using realtime as\nbackend.,,sorcery.conf,res_sorcery_astdb res_sorcery_config res_sorcery_memory res_sorcery_realtime,,))
$(eval $(call BuildAsteriskModule,res-sorcery-memory-cache,Sorcery memory cache object wizard,Sorcery memory cache object wizard.,,,res_sorcery_memory_cache,,))
$(eval $(call BuildAsteriskModule,res-speech,Speech Recognition API,Generic speech recognition API.,,,res_speech,,))
$(eval $(call BuildAsteriskModule,res-speech-aeap,AEAP Speech Engine,AEAP Speech Engine support.,+asterisk-res-aeap +asterisk-res-speech,,res_speech_aeap,,))
$(eval $(call BuildAsteriskModule,res-srtp,SRTP Support,Secure RTP.,+libsrtp2,,res_srtp,,))
$(eval $(call BuildAsteriskModule,res-stasis,Stasis application,Stasis application support.,,,res_stasis,,))
$(eval $(call BuildAsteriskModule,res-stasis-answer,Stasis application answer,Stasis application answer support.,+$(PKG_NAME)-res-stasis,,res_stasis_answer,,))
@ -1058,7 +1043,7 @@ $(eval $(call BuildAsteriskModule,res-stasis-playback,Stasis application playbac
$(eval $(call BuildAsteriskModule,res-stasis-recording,Stasis application recording,Stasis application recording support.,+$(PKG_NAME)-res-stasis,,res_stasis_recording,,))
$(eval $(call BuildAsteriskModule,res-stasis-snoop,Stasis application snoop,Stasis application snoop support.,+$(PKG_NAME)-res-stasis-recording,,res_stasis_snoop,,))
$(eval $(call BuildAsteriskModule,res-statsd,statsd client,Statsd client support.,,statsd.conf,res_statsd,,))
$(eval $(call BuildAsteriskModule,res-stir-shaken,STIR/SHAKEN resource module,STIR/SHAKEN resource module.,+$(PKG_NAME)-curl +libjwt,stir_shaken.conf,res_stir_shaken,,))
$(eval $(call BuildAsteriskModule,res-stir-shaken,STIR/SHAKEN resource module,STIR/SHAKEN resource module.,+$(PKG_NAME)-curl,stir_shaken.conf,res_stir_shaken,,))
$(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,,))
@ -1081,6 +1066,8 @@ $(eval $(call BuildAsteriskUtil,astdb2sqlite3,Convert astdb to SQLite 3.,,))
$(eval $(call BuildAsteriskUtil,astdb2bdb,Convert astdb back to Berkeley DB 1.86.,,))
$(eval $(call BuildAsteriskUtil,check_expr,Expression checker [older version].,,))
$(eval $(call BuildAsteriskUtil,check_expr2,Expression checker [newer version].,,))
$(eval $(call BuildAsteriskUtil,conf2ael,Convert .conf to .ael.,+$(PKG_NAME)-pbx-ael,))
$(eval $(call BuildAsteriskUtil,muted,Listens for AMI events. Mutes soundcard during call.,,muted.conf))
$(eval $(call BuildAsteriskUtil,smsq,Send messages from command line.,+libpopt,))
$(eval $(call BuildAsteriskUtil,stereorize,Merge two mono WAV-files to one stereo WAV-file.,,))
$(eval $(call BuildAsteriskUtil,streamplayer,A utility for reading from a raw TCP stream [MOH source].,,))

View file

@ -10,7 +10,7 @@
# varlibdir => '/var/lib/asterisk'
config asterisk 'general'
option enabled '1'
option enabled '0'
option log_stderr '1'
option log_stdout '0'
option log_stdout '1'
option options ''

View file

@ -1,7 +1,7 @@
#!/bin/sh /etc/rc.common
# Copyright (C) 2014 OpenWrt.org
START=92
START=99
USE_PROCD=1
@ -10,7 +10,7 @@ USE_PROCD=1
NAME=asterisk
COMMAND=/usr/sbin/$NAME
LOGGER="/usr/bin/logger -p daemon.err -s -t $NAME --"
LOGGER="/usr/bin/logger -p user.err -s -t $NAME --"
start_service() {
@ -26,11 +26,11 @@ start_service() {
config_get_bool enabled general enabled 0
if [ $enabled -eq 0 ]; then
$LOGGER service not enabled in /etc/config/$NAME
return 1
exit 1
fi
config_get_bool log_stderr general log_stderr 1
config_get_bool log_stdout general log_stdout 0
config_get_bool log_stdout general log_stdout 1
config_get options general options
@ -51,6 +51,7 @@ start_service() {
procd_open_instance
procd_set_param command $COMMAND
procd_append_param command \
-U "$NAME" \
$options \
-f
# forward stderr to logd
@ -60,7 +61,3 @@ start_service() {
procd_close_instance
}
reload_service() {
procd_send_signal $NAME
}

View file

@ -0,0 +1,28 @@
--- a/configure.ac
+++ b/configure.ac
@@ -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)
-AC_RUN_IFELSE(
- [AC_LANG_PROGRAM([#include <semaphore.h>],
- [sem_t sem; return sem_init(&sem, 0, 0);])],
+AC_LINK_IFELSE(
+ [AC_LANG_PROGRAM(
+ [#include <semaphore.h>],
+ [#if defined(__UCLIBC__)
+ i_dont_exist sem;
+ #else
+ sem_t sem;
+ #endif
+ return sem_init(&sem, 0, 0);])],
AC_MSG_RESULT(yes)
AC_DEFINE([HAS_WORKING_SEMAPHORE], 1, [Define to 1 if anonymous semaphores work.]),
- AC_MSG_RESULT(no),
- AC_MSG_RESULT(cross-compile)
- AC_MSG_NOTICE([WARNING: result yes guessed because of cross compilation])
- AC_DEFINE([HAS_WORKING_SEMAPHORE], 1, [Define to 1 if anonymous semaphores work.])
+ AC_MSG_RESULT(no)
)
LIBS="$save_LIBS"

View file

@ -0,0 +1,33 @@
From 9b4070944578336506cd0a76de6f733c72d0ca74 Mon Sep 17 00:00:00 2001
From: "Yann E. MORIN" <yann.morin.1998@free.fr>
Date: Sat, 13 Oct 2018 11:11:15 +0200
Subject: [PATCH] configure: fix detection of re-entrant resolver functions
Fixes https://issues.asterisk.org/jira/browse/ASTERISK-21795
uClibc does not provide res_nsearch:
asterisk-16.0.0/main/dns.c:506: undefined reference to `res_nsearch'
Patch coded by Yann E. MORIN:
http://lists.busybox.net/pipermail/buildroot/2018-October/232630.html
Signed-off-by: Bernd Kuhls <bernd.kuhls@t-online.de>
---
configure.ac | 6 +++++-
1 file changed, 5 insertions(+), 1 deletion(-)
--- a/configure.ac
+++ b/configure.ac
@@ -1484,7 +1484,11 @@ AC_LINK_IFELSE(
#include <arpa/nameser.h>
#endif
#include <resolv.h>],
- [int foo = res_ninit(NULL);])],
+ [
+ int foo;
+ foo = res_ninit(NULL);
+ foo = res_nsearch(NULL, NULL, 0, 0, NULL, 0);
+ ])],
AC_MSG_RESULT(yes)
AC_DEFINE([HAVE_RES_NINIT], 1, [Define to 1 if your system has the re-entrant resolver functions.])
AC_SEARCH_LIBS(res_9_ndestroy, resolv)

View file

@ -1,6 +1,6 @@
--- a/res/ael/ael.flex
+++ b/res/ael/ael.flex
@@ -598,7 +598,7 @@ includes { STORE_POS; return KW_INCLUDES
@@ -601,7 +601,7 @@ includes { STORE_POS; return KW_INCLUDES
snprintf(fnamebuf2,sizeof(fnamebuf2), "%s/%s", (char *)ast_config_AST_CONFIG_DIR, fnamebuf);
ast_copy_string(fnamebuf,fnamebuf2,sizeof(fnamebuf));
}
@ -11,7 +11,7 @@
glob_ret = glob(fnamebuf, GLOB_NOMAGIC|GLOB_BRACE, NULL, &globbuf);
--- a/res/ael/ael_lex.c
+++ b/res/ael/ael_lex.c
@@ -1966,7 +1966,7 @@ YY_RULE_SETUP
@@ -1982,7 +1982,7 @@ YY_RULE_SETUP
snprintf(fnamebuf2,sizeof(fnamebuf2), "%s/%s", (char *)ast_config_AST_CONFIG_DIR, fnamebuf);
ast_copy_string(fnamebuf,fnamebuf2,sizeof(fnamebuf));
}

View file

@ -17,10 +17,10 @@
* build.h
--- a/build_tools/make_xml_documentation
+++ b/build_tools/make_xml_documentation
@@ -193,7 +193,7 @@ printf "Building Documentation For: "
@@ -187,7 +187,7 @@ printf "Building Documentation For: "
for subdir in ${mod_subdirs} ; do
printf "%s " "${subdir}"
subdir_path=$(make_absolute "$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

View file

@ -1,6 +1,6 @@
--- a/configure.ac
+++ b/configure.ac
@@ -1272,7 +1272,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,6 +1,6 @@
--- a/configure.ac
+++ b/configure.ac
@@ -2623,7 +2623,7 @@ 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])

View file

@ -1,35 +0,0 @@
--- a/include/asterisk/compat.h
+++ b/include/asterisk/compat.h
@@ -130,14 +130,16 @@ void timersub(struct timeval *tvend, str
#include <errno.h>
-#ifdef SOLARIS
+#ifndef __BEGIN_DECLS
#define __BEGIN_DECLS
#define __END_DECLS
+#endif
#ifndef __P
#define __P(p) p
#endif
+#ifdef SOLARIS
#include <alloca.h>
#include <strings.h>
#include <pthread.h>
--- a/utils/db1-ast/include/db.h
+++ b/utils/db1-ast/include/db.h
@@ -68,8 +68,11 @@ typedef unsigned long long u_int64_t;
#endif /* __FreeBSD__ */
#endif
-#ifdef SOLARIS
+#ifndef __P
#define __P(p) p
+#endif
+
+#ifndef __BEGIN_DECLS
#define __BEGIN_DECLS
#define __END_DECLS
#endif

View file

@ -1,17 +0,0 @@
Since commit dc701d6 in the OpenWrt packages repo the host libxml2 package
provides a static lib only. But Asterisk does not check that and calls
pkg-config without "--static". The result is that menuselect doesn't build.
So don't use pkg-config for the libxml2 detection. Asterisk will resort to
use xml2-config, which outputs all the flags needed.
--- a/menuselect/configure.ac
+++ b/menuselect/configure.ac
@@ -91,7 +91,6 @@ else
AST_EXT_LIB_CHECK([TINFO], [tinfo], [keypad], [curses.h])
fi
-AST_PKG_CONFIG_CHECK([LIBXML2], [libxml-2.0])
AST_EXT_TOOL_CHECK([LIBXML2], [xml2-config], , ,
[#include <libxml/tree.h>
#include <libxml/parser.h>],

View file

@ -1,17 +0,0 @@
--- a/apps/app_queue.c
+++ b/apps/app_queue.c
@@ -4625,8 +4625,12 @@ static int is_longest_waiting_caller(str
* will be unused until the first caller is picked up.
*/
if (ch->start < caller->start && !ch->pending) {
- ast_debug(1, "Queue %s has a call at position %i that's been waiting longer (%li vs %li)\n",
- q->name, ch->pos, ch->start, caller->start);
+ char time1[AST_TIME_T_LEN];
+ char time2[AST_TIME_T_LEN];
+ ast_time_t_to_string(ch->start, time1, sizeof(time1));
+ ast_time_t_to_string(caller->start, time2, sizeof(time2));
+ ast_debug(1, "Queue %s has a call at position %i that's been waiting longer (%s vs %s)\n",
+ q->name, ch->pos, time1, time2);
is_longest_waiting = 0;
break;
}

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

@ -1,73 +0,0 @@
--- a/include/asterisk/res_pjsip.h
+++ b/include/asterisk/res_pjsip.h
@@ -238,6 +238,8 @@ struct ast_sip_transport {
AST_STRING_FIELD(external_media_address);
/*! Optional domain to use for messages if provided could not be found */
AST_STRING_FIELD(domain);
+ /*! Contact FQDN */
+ AST_STRING_FIELD(contact_fqdn);
);
/*! Type of transport */
enum ast_transport type;
--- a/res/res_pjsip/config_transport.c
+++ b/res/res_pjsip/config_transport.c
@@ -1830,6 +1830,7 @@ int ast_sip_initialize_sorcery_transport
ast_sorcery_object_field_register(sorcery, "transport", "external_signaling_port", "0", OPT_UINT_T, PARSE_IN_RANGE, FLDSET(struct ast_sip_transport, external_signaling_port), 0, 65535);
ast_sorcery_object_field_register(sorcery, "transport", "external_media_address", "", OPT_STRINGFIELD_T, 0, STRFLDSET(struct ast_sip_transport, external_media_address));
ast_sorcery_object_field_register(sorcery, "transport", "domain", "", OPT_STRINGFIELD_T, 0, STRFLDSET(struct ast_sip_transport, domain));
+ ast_sorcery_object_field_register(sorcery, "transport", "contact_fqdn", "", OPT_STRINGFIELD_T, 0, STRFLDSET(struct ast_sip_transport, contact_fqdn));
ast_sorcery_object_field_register_custom(sorcery, "transport", "verify_server", "", transport_tls_bool_handler, verify_server_to_str, NULL, 0, 0);
ast_sorcery_object_field_register_custom(sorcery, "transport", "verify_client", "", transport_tls_bool_handler, verify_client_to_str, NULL, 0, 0);
ast_sorcery_object_field_register_custom(sorcery, "transport", "require_client_cert", "", transport_tls_bool_handler, require_client_cert_to_str, NULL, 0, 0);
--- a/res/res_pjsip/pjsip_config.xml
+++ b/res/res_pjsip/pjsip_config.xml
@@ -1738,6 +1738,9 @@
<configOption name="domain">
<synopsis>Domain the transport comes from</synopsis>
</configOption>
+ <configOption name="contact_fqdn">
+ <synopsis>FQDN to have in contact header</synopsis>
+ </configOption>
<configOption name="external_media_address">
<synopsis>External IP address to use in RTP handling</synopsis>
<description><para>
--- a/res/res_pjsip/pjsip_manager.xml
+++ b/res/res_pjsip/pjsip_manager.xml
@@ -179,6 +179,9 @@
<parameter name="Domain">
<para><xi:include xpointer="xpointer(/docs/configInfo[@name='res_pjsip']/configFile[@name='pjsip.conf']/configObject[@name='transport']/configOption[@name='domain']/synopsis/node())"/></para>
</parameter>
+ <parameter name="ContactFQDN">
+ <para><xi:include xpointer="xpointer(/docs/configInfo[@name='res_pjsip']/configFile[@name='pjsip.conf']/configObject[@name='transport']/configOption[@name='contact_fqdn']/synopsis/node())"/></para>
+ </parameter>
<parameter name="VerifyServer">
<para><xi:include xpointer="xpointer(/docs/configInfo[@name='res_pjsip']/configFile[@name='pjsip.conf']/configObject[@name='transport']/configOption[@name='verify_server']/synopsis/node())"/></para>
</parameter>
--- a/res/res_pjsip_nat.c
+++ b/res/res_pjsip_nat.c
@@ -365,7 +365,11 @@ static pj_status_t process_nat(pjsip_tx_
pjsip_method_cmp(&cseq->method, &pjsip_register_method)) {
/* We can only rewrite the URI when one is present */
if (uri || (uri = ast_sip_get_contact_sip_uri(tdata))) {
- pj_strdup2(tdata->pool, &uri->host, ast_sockaddr_stringify_host(&transport_state->external_signaling_address));
+ if (!ast_strlen_zero(transport->contact_fqdn)) {
+ pj_strdup2(tdata->pool, &uri->host, transport->contact_fqdn);
+ } else {
+ pj_strdup2(tdata->pool, &uri->host, ast_sockaddr_stringify_host(&transport_state->external_signaling_address));
+ }
if (transport->external_signaling_port) {
uri->port = transport->external_signaling_port;
ast_debug(4, "Re-wrote Contact URI port to %d\n", uri->port);
@@ -375,7 +379,11 @@ static pj_status_t process_nat(pjsip_tx_
/* Update the via header if relevant */
if ((tdata->msg->type == PJSIP_REQUEST_MSG) && (via || (via = pjsip_msg_find_hdr(tdata->msg, PJSIP_H_VIA, NULL)))) {
- pj_strdup2(tdata->pool, &via->sent_by.host, ast_sockaddr_stringify_host(&transport_state->external_signaling_address));
+ if (!ast_strlen_zero(transport->contact_fqdn)) {
+ pj_strdup2(tdata->pool, &via->sent_by.host, transport->contact_fqdn);
+ } else {
+ pj_strdup2(tdata->pool, &via->sent_by.host, ast_sockaddr_stringify_host(&transport_state->external_signaling_address));
+ }
if (transport->external_signaling_port) {
via->sent_by.port = transport->external_signaling_port;
}

Some files were not shown because too many files have changed in this diff Show more