diff options
-rwxr-xr-x | contrib/scripts/install_prereq | 76 | ||||
-rw-r--r-- | res/res_pjsip_rfc3326.c | 41 |
2 files changed, 94 insertions, 23 deletions
diff --git a/contrib/scripts/install_prereq b/contrib/scripts/install_prereq index 1270349bd..e588d5cd1 100755 --- a/contrib/scripts/install_prereq +++ b/contrib/scripts/install_prereq @@ -51,6 +51,38 @@ PACKAGES_RH="$PACKAGES_RH wget subversion" PACKAGES_RH="$PACKAGES_RH bzip2 patch python-devel" # Basic build system: +PACKAGES_SUSE="make gcc gcc-c++ pkg-config" +# Asterisk: basic requirements: +PACKAGES_SUSE="$PACKAGES_SUSE libedit-devel libjansson-devel libuuid-devel sqlite3-devel libxml2-devel" +# Asterisk: for addons: +PACKAGES_SUSE="$PACKAGES_SUSE speex-devel speexdsp-devel libogg-devel libvorbis-devel alsa-devel portaudio-devel libcurl-devel xmlstarlet bison flex" +PACKAGES_SUSE="$PACKAGES_SUSE postgresql-devel unixODBC-devel libtool libneon-devel gmime-devel lua-devel liburiparser-devel libxslt-devel libopenssl-devel" +PACKAGES_SUSE="$PACKAGES_SUSE libmysqlclient-devel bluez-devel freeradius-client-devel freetds-devel bash" +PACKAGES_SUSE="$PACKAGES_SUSE net-snmp-devel iksemel-devel libcorosync-devel newt-devel popt-devel libical-devel spandsp-devel" +PACKAGES_SUSE="$PACKAGES_SUSE imap-devel libsrtp2-devel libgsm-devel doxygen graphviz zlib-devel openldap2-devel" +PACKAGES_SUSE="$PACKAGES_SUSE codec2-devel fftw3-devel libsndfile-devel unbound-devel" +# Asterisk: for the unpackaged below: +PACKAGES_SUSE="$PACKAGES_SUSE wget subversion" +# Asterisk: for ./configure --with-pjproject-bundled: +PACKAGES_SUSE="$PACKAGES_SUSE bzip2 patch python-devel" + +# Basic build system: +PACKAGES_ARCH="make gcc pkg-config" +# Asterisk: basic requirements: +PACKAGES_ARCH="$PACKAGES_ARCH libedit jansson libutil-linux libxml2 sqlite" +# Asterisk: for addons: +PACKAGES_ARCH="$PACKAGES_ARCH speex speexdsp libogg libvorbis alsa-lib portaudio curl xmlstarlet bison flex" +PACKAGES_ARCH="$PACKAGES_ARCH postgresql-libs unixodbc libtool neon gmime lua uriparser libxslt openssl" +PACKAGES_ARCH="$PACKAGES_ARCH libmariadbclient bluez-libs radcli freetds bash" +PACKAGES_ARCH="$PACKAGES_ARCH net-snmp libnewt popt libical spandsp" +PACKAGES_ARCH="$PACKAGES_ARCH c-client binutils libsrtp gsm doxygen graphviz zlib libldap" +PACKAGES_ARCH="$PACKAGES_ARCH fftw libsndfile unbound" +# Asterisk: for the unpackaged below: +PACKAGES_ARCH="$PACKAGES_ARCH wget subversion" +# Asterisk: for ./configure --with-pjproject-bundled: +PACKAGES_ARCH="$PACKAGES_ARCH bzip2 patch python2" + +# Basic build system: PACKAGES_NBSD="gmake pkg-config" # Asterisk: basic requirements: PACKAGES_NBSD="$PACKAGES_NBSD editline jansson sqlite3 libuuid libxml2" @@ -147,6 +179,15 @@ check_installed_rpms() { done } +check_installed_pacman() { + for pack in "$@" + do + if ! pacman -Q --explicit $pack >/dev/null 2>/dev/null + then echo $pack + fi + done +} + check_installed_pkgs() { for pack in "$@" do @@ -165,6 +206,15 @@ check_installed_fpkgs() { done } +check_installed_zypper() { + for pack in "$@" + do + if ! zypper se -ixnC $pack >/dev/null 2>/dev/null + then echo $pack + fi + done +} + handle_debian() { if ! [ -x "$(command -v aptitude)" ]; then apt-get install aptitude @@ -183,6 +233,13 @@ handle_rh() { fi } +handle_arch() { + extra_packs=`check_installed_pacman $PACKAGES_ARCH` + if [ x"$extra_packs" != "x" ] ; then + $testcmd pacman -S --asexplicit --noconfirm $extra_packs + fi +} + handle_nbsd() { extra_packs=`check_installed_pkgs $PACKAGES_NBSD` if [ x"$extra_packs" != "x" ] ; then @@ -208,6 +265,13 @@ handle_fbsd() { fi } +handle_SUSE() { + extra_packs=`check_installed_zypper $PACKAGES_SUSE` + if [ x"$extra_packs" != "x" ] ; then + $testcmd zypper install --no-confirm $extra_packs + fi +} + install_unpackaged() { echo "*** Installing NBS (Network Broadcast Sound) ***" svn co http://svn.digium.com/svn/nbs/trunk nbs-trunk @@ -284,10 +348,6 @@ if [ -f /etc/mandrake-release ]; then unsupported_distro='Mandriva' fi -if [ -f /etc/SuSE-release ]; then - unsupported_distro='SUSE' -fi - if [ -f /etc/slackware-version ]; then unsupported_distro='Slackware' fi @@ -302,6 +362,14 @@ if [ -r /etc/debian_version ]; then handle_debian elif [ -r /etc/redhat-release ]; then handle_rh +elif [ -f /etc/SuSE-release -o -f /etc/novell-release ]; then + handle_SUSE +elif [ -f /etc/os-release ] && . /etc/os-release && [ "$ID" = "opensuse" ]; then + handle_SUSE +elif [ -r /etc/arch-release ]; then + handle_arch +elif [ -f /etc/os-release ] && . /etc/os-release && [ "$ID_LIKE" = "archlinux" ]; then + handle_arch # $ID=arch elif [ "$OS" = 'NetBSD' ]; then handle_nbsd elif [ "$OS" = 'OpenBSD' ]; then diff --git a/res/res_pjsip_rfc3326.c b/res/res_pjsip_rfc3326.c index 5ac16f024..76b0d08b0 100644 --- a/res/res_pjsip_rfc3326.c +++ b/res/res_pjsip_rfc3326.c @@ -35,32 +35,35 @@ static void rfc3326_use_reason_header(struct ast_sip_session *session, struct pjsip_rx_data *rdata) { - const pj_str_t str_reason = { "Reason", 6 }; - pjsip_generic_string_hdr *header = pjsip_msg_find_hdr_by_name(rdata->msg_info.msg, &str_reason, NULL); - char buf[20], *cause, *text; + static const pj_str_t str_reason = { "Reason", 6 }; + pjsip_generic_string_hdr *header; + char buf[20]; + char *cause; + char *text; int code; - if (!header) { - return; - } + header = pjsip_msg_find_hdr_by_name(rdata->msg_info.msg, &str_reason, NULL); + for (; header; + header = pjsip_msg_find_hdr_by_name(rdata->msg_info.msg, &str_reason, header->next)) { + ast_copy_pj_str(buf, &header->hvalue, sizeof(buf)); + cause = ast_skip_blanks(buf); - ast_copy_pj_str(buf, &header->hvalue, sizeof(buf)); - cause = ast_skip_blanks(buf); + if (strncasecmp(cause, "Q.850", 5) || !(cause = strstr(cause, "cause="))) { + continue; + } - if (strncasecmp(cause, "Q.850", 5) || !(cause = strstr(cause, "cause="))) { - return; - } + /* If text is present get rid of it */ + if ((text = strstr(cause, ";"))) { + *text = '\0'; + } - /* If text is present get rid of it */ - if ((text = strstr(cause, ";"))) { - *text = '\0'; - } + if (sscanf(cause, "cause=%30d", &code) != 1) { + continue; + } - if (sscanf(cause, "cause=%30d", &code) != 1) { - return; + ast_channel_hangupcause_set(session->channel, code & 0x7f); + break; } - - ast_channel_hangupcause_set(session->channel, code & 0x7f); } static int rfc3326_incoming_request(struct ast_sip_session *session, struct pjsip_rx_data *rdata) |