Commit c7e134d3 authored by Timo Teräs's avatar Timo Teräs
Browse files

main/asterisk: fix pjsip module loading

ref #6644
parent a94bdb30
......@@ -3,7 +3,7 @@
# Maintainer: Timo Teras <timo.teras@iki.fi>
pkgname=asterisk
pkgver=14.2.1
pkgrel=1
pkgrel=2
pkgdesc="Asterisk: A Module Open Source PBX System"
pkgusers="asterisk"
pkggroups="asterisk"
......@@ -31,26 +31,16 @@ source="$_download/asterisk-$pkgver.tar.gz
ASTERISK-24517.patch
fix-strerror_r.patch
musl-mutex-init.patch
restore-multihomed-module.patch
asterisk.initd
asterisk.confd
asterisk.logrotate"
_builddir="$srcdir/$pkgname-${pkgver/_/-}"
builddir="$srcdir/$pkgname-${pkgver/_/-}"
prepare() {
cd "$srcdir"
if [ -n "$_patches" ]; then
mv "$pkgname-$_xy.0" "$pkgname-${pkgver/_/-}"
fi
cd "$_builddir"
for i in $source; do
case $i in
*.patch) msg "$i"; patch -p1 -i "$srcdir"/$i || return 1;;
*patch.gz) msg "${i##*/}"; gunzip < "$srcdir"/${i##*/} | patch -p0 || return 1;;
esac
done
default_prepare || return 1
# asteriskssl does not have direct references to libssl, but looks up
# symbols from it using dlsym(RTLD_NEXT), so use --no-as-needed for it.
......@@ -63,7 +53,7 @@ prepare() {
}
build() {
cd "$_builddir"
cd "$builddir"
SHA1SUM="$PWD"/build_tools/sha1sum-sh ./configure \
--build=$CBUILD \
--host=$CHOST \
......@@ -114,7 +104,7 @@ build() {
}
package() {
cd "$_builddir"
cd "$builddir"
make -j1 DESTDIR="$pkgdir" LDCONFIG_FLAGS="-n" install || return 1
install -d "$pkgdir"/var/run/asterisk
......@@ -212,7 +202,7 @@ alsa() { _find_and_move '*_alsa*'; }
sample() {
pkgdesc="Sample configuration files for asterisk"
cd "$_builddir"
cd "$builddir"
mkdir -p "$subpkgdir"/var/lib/asterisk/phoneprov
make -j1 samples DESTDIR="$subpkgdir"
......@@ -242,6 +232,7 @@ md5sums="e65daf9b1d65b8047b2117f21587ab35 asterisk-14.2.1.tar.gz
5f8eaac5d48c47033028abec56a881a5 ASTERISK-24517.patch
b562be4a764d275dad87682642b56ee3 fix-strerror_r.patch
1ca5e8326dc03c963a7ce5455d0f21ba musl-mutex-init.patch
f7038bbe05b7a32e7408fea7b92f7fc8 restore_multihomed_module.patch
4bdc82ba3d6bdfdedc71e5da2fde5ec2 asterisk.initd
ed31d7ba37bcf8b0346dcf8593c395f0 asterisk.confd
3e65172275684373e1a25c8a11224411 asterisk.logrotate"
......@@ -250,6 +241,7 @@ d32a5a695cee1699011d0e9ad02eb43af612def06f92017627194099edf98e3f asterisk-addon
98a49e7241e0c7a7dd814ed472aa1b3be9b1ee3f2966c286fd8a3e11c7c278ae ASTERISK-24517.patch
546c0d60e08a17e7b888baada693a08608c3d4f54709e2959305c4a772bb8158 fix-strerror_r.patch
a5205ed44b57a72934baf8cde543ddb179f277494181818905110bfdcccfe7d9 musl-mutex-init.patch
c65bb73a276824ba8518aaa5f439e7fdbd10ba3b719bec9e848c55cfb8ca853a restore_multihomed_module.patch
10454553733e6cc52c6e9db508768a638655d99c095c5b39fb043858c088f21f asterisk.initd
d221148583b57f9c37d7160f2493f0d204ad11f7abb17e3a3534e108ad5452d7 asterisk.confd
77b253b6db71460acf9a51e87ad4c8582027a46db01a4c50fb048bada58c19d1 asterisk.logrotate"
......@@ -258,6 +250,7 @@ aacef3f4796fb1abd33266998b53909cb4b36e7cc5ad2f7bac68bdc43e9a9072d9a4e2e7e681bddf
e0b43c8a0a7e041d5853f7508ebff747616d9745449ab4a5d28788fbe076f0e9d49dc7f9e818f5b55fd430c625d1d5ec8d8f7fe6f7c56315f16180ce405cf282 ASTERISK-24517.patch
46f661b5056a571181adfd93a34c836e2df091e1bfd400e0c09794f43b097c4401f47bf8f4b620a1549fa90bf287b3018d803c102c6c7835a67c4c85ea5c2e76 fix-strerror_r.patch
f72c2e04de80d3ed9ce841308101383a1655e6da7a3c888ad31fffe63d1280993e08aefcf8e638316d439c68b38ee05362c87503fca1f36343976a01af9d6eb1 musl-mutex-init.patch
935c25c7b1cdbd376056e20232a0e8c38dd32c344f50306d99930bf7cb37685c31329ead273b08ac9ab76daa9386adfb05b57440e46a39cb80e5542d65e8e3ed restore_multihomed_module.patch
cd5bd1c1d7db0a44b14eb10e6d098af0c6474c8fe1a57395090d6795ac00e9243d004b7d24eba2cfd5bd6d6407c271913e794551a8dfcf3cf93e89fc91349e12 asterisk.initd
ab6b6f08ff43268cbb1abb7ed7d678949991ba495682a644bbaeb017d6adbff0a43297905fd73ae8db1786a28d5b5904f1bc253209a0e388c8a27f26c6ce14ed asterisk.confd
7591d2faf539d05d9ee4e431c78a5e20686721fd79221ad94dffeeaff9282220b09cb9aec214bd7a8d12affaec0276c9c91e6e21af8b6712c0a9502b60b02f2b asterisk.logrotate"
https://issues.asterisk.org/jira/browse/ASTERISK-26518
commit 500470607eae4144b44ed4f188cfff437d56f0e7
Author: Alex Hermann <alex@hexla.nl>
Date: Fri Jan 20 11:09:01 2017 +0100
pjsip: Restore multihomed module
Since the automatic dual stack commit, the multihome module has become
part of the pjsip core module. This caused a circular dependency loop
preventing the pjsip module from loading. By putting the logic back into
its own module, things can be loaded again.
diff --git a/res/res_pjsip.c b/res/res_pjsip.c
index dd4a619d2a..6e9523d76b 100644
--- a/res/res_pjsip.c
+++ b/res/res_pjsip.c
@@ -4317,6 +4317,5 @@ static int unload_pjsip(void *data)
if (ast_pjsip_endpoint && serializer_pool[0]) {
ast_res_pjsip_cleanup_options_handling();
- ast_res_pjsip_cleanup_message_ip_updater();
ast_sip_destroy_distributor();
ast_res_pjsip_destroy_configuration();
ast_sip_destroy_system();
@@ -4488,11 +4487,6 @@ static int load_module(void)
ast_res_pjsip_init_options_handling(0);
- if (ast_res_pjsip_init_message_ip_updater()) {
- ast_log(LOG_ERROR, "Failed to initialize message IP updating. Aborting load\n");
- goto error;
- }
-
ast_cli_register_multiple(cli_commands, ARRAY_LEN(cli_commands));
AST_TEST_REGISTER(xml_sanitization_end_null);
diff --git a/res/res_pjsip/pjsip_message_ip_updater.c b/res/res_pjsip_multihomed.c
similarity index 94%
rename from res/res_pjsip/pjsip_message_ip_updater.c
rename to res/res_pjsip_multihomed.c
index 7671ad0a75..3a29255973 100644
--- a/res/res_pjsip/pjsip_message_ip_updater.c
+++ b/res/res_pjsip_multihomed.c
@@ -16,6 +16,12 @@
* at the top of the source tree.
*/
+/*** MODULEINFO
+ <depend>pjproject</depend>
+ <depend>res_pjsip</depend>
+ <support_level>core</support_level>
+ ***/
+
#include "asterisk.h"
#include <pjsip.h>
@@ -23,7 +29,8 @@
#include "asterisk/res_pjsip.h"
#include "asterisk/res_pjsip_session.h"
-#include "include/res_pjsip_private.h"
+#include "res_pjsip/include/res_pjsip_private.h"
+#include "asterisk/module.h"
#define MOD_DATA_RESTRICTIONS "restrictions"
@@ -273,31 +280,41 @@ static pj_status_t multihomed_on_tx_message(pjsip_tx_data *tdata)
return PJ_SUCCESS;
}
-void ast_res_pjsip_cleanup_message_ip_updater(void)
+static int unload_module(void)
{
ast_sip_unregister_service(&multihomed_module);
ast_sip_unregister_supplement(&multihomed_supplement);
ast_sip_session_unregister_supplement(&multihomed_session_supplement);
+ return 0;
}
-int ast_res_pjsip_init_message_ip_updater(void)
+static int load_module(void)
{
+ CHECK_PJSIP_MODULE_LOADED();
+
if (ast_sip_session_register_supplement(&multihomed_session_supplement)) {
ast_log(LOG_ERROR, "Could not register multihomed session supplement for outgoing requests\n");
- return -1;
+ return AST_MODULE_LOAD_FAILURE;
}
if (ast_sip_register_supplement(&multihomed_supplement)) {
ast_log(LOG_ERROR, "Could not register multihomed supplement for outgoing requests\n");
- ast_res_pjsip_cleanup_message_ip_updater();
- return -1;
+ unload_module();
+ return AST_MODULE_LOAD_FAILURE;
}
if (ast_sip_register_service(&multihomed_module)) {
ast_log(LOG_ERROR, "Could not register multihomed module for incoming and outgoing requests\n");
- ast_res_pjsip_cleanup_message_ip_updater();
- return -1;
+ unload_module();
+ return AST_MODULE_LOAD_FAILURE;
}
- return 0;
+ return AST_MODULE_LOAD_SUCCESS;
}
+
+AST_MODULE_INFO(ASTERISK_GPL_KEY, AST_MODFLAG_LOAD_ORDER, "PJSIP Multihomed Routing Support",
+ .support_level = AST_MODULE_SUPPORT_CORE,
+ .load = load_module,
+ .unload = unload_module,
+ .load_pri = AST_MODPRI_CHANNEL_DEPEND,
+);
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment