diff options
-rw-r--r-- | Makefile | 20 | ||||
-rw-r--r-- | apps/app_osplookup.c | 6 | ||||
-rw-r--r-- | apps/app_voicemail.c | 74 | ||||
-rw-r--r-- | cdr/cdr_adaptive_odbc.c | 1 | ||||
-rw-r--r-- | cdr/cdr_odbc.c | 1 | ||||
-rw-r--r-- | cel/cel_odbc.c | 1 | ||||
-rw-r--r-- | channels/chan_sip.c | 14 | ||||
-rw-r--r-- | funcs/func_odbc.c | 1 | ||||
-rw-r--r-- | include/asterisk/astosp.h | 31 | ||||
-rw-r--r-- | res/res_config_odbc.c | 1 | ||||
-rw-r--r-- | res/res_http_post.c | 2 | ||||
-rw-r--r-- | res/res_pjsip_session.c | 31 |
12 files changed, 115 insertions, 68 deletions
@@ -239,7 +239,9 @@ ifeq ($(OSARCH),SunOS) _ASTCFLAGS+=-Wcast-align -DSOLARIS -I../include/solaris-compat -I/opt/ssl/include -I/usr/local/ssl/include -D_XPG4_2 -D__EXTENSIONS__ endif -ifneq ($(GREP),:) +ifeq ($(GREP),) +else ifeq ($(GREP),:) +else ASTERISKVERSION:=$(shell GREP=$(GREP) AWK=$(AWK) GIT=$(GIT) build_tools/make_version .) endif ifneq ($(AWK),) @@ -467,7 +469,9 @@ endif $(INSTALL) -m 644 $$x "$(DESTDIR)$(ASTDATADIR)/rest-api" ; \ done -ifneq ($(GREP),:) +ifeq ($(GREP),) +else ifeq ($(GREP),:) +else XML_core_en_US = $(foreach dir,$(MOD_SUBDIRS),$(shell $(GREP) -l "language=\"en_US\"" $(dir)/*.c $(dir)/*.cc 2>/dev/null)) endif @@ -486,7 +490,9 @@ doc/core-en_US.xml: makeopts .lastclean $(XML_core_en_US) @echo @echo "</docs>" >> $@ -ifneq ($(GREP),:) +ifeq ($(GREP),) +else ifeq ($(GREP),:) +else XML_full_en_US = $(foreach dir,$(MOD_SUBDIRS),$(shell $(GREP) -l "language=\"en_US\"" $(dir)/*.c $(dir)/*.cc 2>/dev/null)) endif @@ -630,7 +636,9 @@ oldmodcheck: fi ld-cache-update: -ifneq ($(LDCONFIG),:) +ifeq ($(LDCONFIG),) +else ifeq ($(LDCONFIG),:) +else ifeq ($(DESTDIR),) # DESTDIR means binary archive creation; ldconfig should be run on postinst @if [ $$(id -u) -eq 0 ] ; then \ $(LDCONFIG) "$(ASTLIBDIR)/" ; \ @@ -984,7 +992,9 @@ ifeq ($(HAVE_DAHDI),1) rm -f $(DESTDIR)$(DAHDI_UDEV_HOOK_DIR)/40-asterisk endif $(MAKE) -C sounds uninstall -ifneq ($(LDCONFIG),:) +ifeq ($(LDCONFIG),) +else ifeq ($(LDCONFIG),:) +else $(LDCONFIG) "$(ASTLIBDIR)/" || : endif diff --git a/apps/app_osplookup.c b/apps/app_osplookup.c index c42e1873e..78f573a6c 100644 --- a/apps/app_osplookup.c +++ b/apps/app_osplookup.c @@ -50,7 +50,6 @@ #include "asterisk/module.h" #include "asterisk/pbx.h" #include "asterisk/cli.h" -#include "asterisk/astosp.h" /*** DOCUMENTATION <application name="OSPAuth" language="en_US"> @@ -436,6 +435,11 @@ </application> ***/ +/* OSP Return statuses */ +#define AST_OSP_SUCCESS ((char*)"SUCCESS") /* Return status, success */ +#define AST_OSP_FAILED ((char*)"FAILED") /* Return status, failed */ +#define AST_OSP_ERROR ((char*)"ERROR") /* Return status, error */ + /* OSP Buffer Sizes */ #define OSP_SIZE_INTSTR ((unsigned int)16) /* OSP signed/unsigned int string buffer size */ #define OSP_SIZE_NORSTR ((unsigned int)256) /* OSP normal string buffer size */ diff --git a/apps/app_voicemail.c b/apps/app_voicemail.c index 72e3e59c1..1e7d09128 100644 --- a/apps/app_voicemail.c +++ b/apps/app_voicemail.c @@ -6089,22 +6089,33 @@ static int has_voicemail(const char *mailbox, const char *folder) return 0; } - +/*! + * \brief Check the given mailbox's message count. + * \param mailbox The @ delimited string for user@context. If no context is found, uses 'default' for the context. + * \param urgentmsgs urgent message count. + * \param newmsgs new message count. + * \param oldmsgs old message count pointer + * \return -1 if error occurred, 0 otherwise. + */ static int inboxcount2(const char *mailbox, int *urgentmsgs, int *newmsgs, int *oldmsgs) { char tmp[256]; char *context; /* If no mailbox, return immediately */ - if (ast_strlen_zero(mailbox)) + if (ast_strlen_zero(mailbox)) { return 0; + } - if (newmsgs) + if (newmsgs) { *newmsgs = 0; - if (oldmsgs) + } + if (oldmsgs) { *oldmsgs = 0; - if (urgentmsgs) + } + if (urgentmsgs) { *urgentmsgs = 0; + } if (strchr(mailbox, ',')) { int tmpnew, tmpold, tmpurgent; @@ -6114,15 +6125,18 @@ static int inboxcount2(const char *mailbox, int *urgentmsgs, int *newmsgs, int * mb = tmp; while ((cur = strsep(&mb, ", "))) { if (!ast_strlen_zero(cur)) { - if (inboxcount2(cur, urgentmsgs ? &tmpurgent : NULL, newmsgs ? &tmpnew : NULL, oldmsgs ? &tmpold : NULL)) + if (inboxcount2(cur, urgentmsgs ? &tmpurgent : NULL, newmsgs ? &tmpnew : NULL, oldmsgs ? &tmpold : NULL)) { return -1; - else { - if (newmsgs) + } else { + if (newmsgs) { *newmsgs += tmpnew; - if (oldmsgs) + } + if (oldmsgs) { *oldmsgs += tmpold; - if (urgentmsgs) + } + if (urgentmsgs) { *urgentmsgs += tmpurgent; + } } } } @@ -6131,17 +6145,21 @@ static int inboxcount2(const char *mailbox, int *urgentmsgs, int *newmsgs, int * ast_copy_string(tmp, mailbox, sizeof(tmp)); - if ((context = strchr(tmp, '@'))) + if ((context = strchr(tmp, '@'))) { *context++ = '\0'; - else + } else { context = "default"; + } - if (newmsgs) + if (newmsgs) { *newmsgs = __has_voicemail(context, tmp, "INBOX", 0); - if (oldmsgs) + } + if (oldmsgs) { *oldmsgs = __has_voicemail(context, tmp, "Old", 0); - if (urgentmsgs) + } + if (urgentmsgs) { *urgentmsgs = __has_voicemail(context, tmp, "Urgent", 0); + } return 0; } @@ -13241,7 +13259,10 @@ static void stop_poll_thread(void) poll_thread = AST_PTHREADT_NULL; } -/*! \brief Append vmu info string into given astman with event_name. */ +/*! + * \brief Append vmu info string into given astman with event_name. + * \return 0 failed. 1 otherwise. +*/ static int append_vmu_info_astman( struct mansession *s, struct ast_vm_user *vmu, @@ -13251,14 +13272,33 @@ static int append_vmu_info_astman( { int new; int old; + char *mailbox; + int ret; if((s == NULL) || (vmu == NULL) || (event_name == NULL) || (actionid == NULL)) { ast_log(LOG_ERROR, "Wrong input parameter."); return 0; } + /* create mailbox string */ + if (!ast_strlen_zero(vmu->context)) { + ret = ast_asprintf(&mailbox, "%s@%s", vmu->mailbox, vmu->context); + } else { + ret = ast_asprintf(&mailbox, "%s", vmu->mailbox); + } + if (ret == -1) { + ast_log(LOG_ERROR, "Could not create mailbox string. err[%s]\n", strerror(errno)); + return 0; + } + /* get mailbox count */ - inboxcount(vmu->mailbox, &new, &old); + ret = inboxcount(mailbox, &new, &old); + ast_free(mailbox); + if (ret == -1) { + ast_log(LOG_ERROR, "Could not get mailbox count. user[%s], context[%s]\n", + vmu->mailbox ?: "", vmu->context ?: ""); + return 0; + } astman_append(s, "Event: %s\r\n" diff --git a/cdr/cdr_adaptive_odbc.c b/cdr/cdr_adaptive_odbc.c index d4da850ce..e04b9fec8 100644 --- a/cdr/cdr_adaptive_odbc.c +++ b/cdr/cdr_adaptive_odbc.c @@ -35,6 +35,7 @@ /*** MODULEINFO <depend>res_odbc</depend> + <depend>generic_odbc</depend> <support_level>core</support_level> ***/ diff --git a/cdr/cdr_odbc.c b/cdr/cdr_odbc.c index b44bbf52a..efa68c1a9 100644 --- a/cdr/cdr_odbc.c +++ b/cdr/cdr_odbc.c @@ -39,6 +39,7 @@ /*** MODULEINFO <depend>res_odbc</depend> + <depend>generic_odbc</depend> <support_level>extended</support_level> ***/ diff --git a/cel/cel_odbc.c b/cel/cel_odbc.c index 05c1095cb..b4967b647 100644 --- a/cel/cel_odbc.c +++ b/cel/cel_odbc.c @@ -28,6 +28,7 @@ /*** MODULEINFO <depend>res_odbc</depend> + <depend>generic_odbc</depend> <support_level>core</support_level> ***/ diff --git a/channels/chan_sip.c b/channels/chan_sip.c index 85701634c..f0cc2a6bd 100644 --- a/channels/chan_sip.c +++ b/channels/chan_sip.c @@ -10964,22 +10964,25 @@ static int process_sdp(struct sip_pvt *p, struct sip_request *req, int t38action if (portno != -1 || vportno != -1 || tportno != -1) { /* We are now ready to change the sip session and RTP structures with the offered codecs, since they are acceptable */ + unsigned int framing; ast_format_cap_remove_by_type(p->jointcaps, AST_MEDIA_TYPE_UNKNOWN); ast_format_cap_append_from_cap(p->jointcaps, newjointcapability, AST_MEDIA_TYPE_UNKNOWN); /* Our joint codec profile for this call */ ast_format_cap_remove_by_type(p->peercaps, AST_MEDIA_TYPE_UNKNOWN); ast_format_cap_append_from_cap(p->peercaps, newpeercapability, AST_MEDIA_TYPE_UNKNOWN); /* The other side's capability in latest offer */ p->jointnoncodeccapability = newnoncodeccapability; /* DTMF capabilities */ + tmp_fmt = ast_format_cap_get_format(p->jointcaps, 0); + framing = ast_format_cap_get_format_framing(p->jointcaps, tmp_fmt); /* respond with single most preferred joint codec, limiting the other side's choice */ if (ast_test_flag(&p->flags[1], SIP_PAGE2_PREFERRED_CODEC)) { - unsigned int framing; - - tmp_fmt = ast_format_cap_get_format(p->jointcaps, 0); - framing = ast_format_cap_get_format_framing(p->jointcaps, tmp_fmt); ast_format_cap_remove_by_type(p->jointcaps, AST_MEDIA_TYPE_UNKNOWN); ast_format_cap_append(p->jointcaps, tmp_fmt, framing); - ao2_ref(tmp_fmt, -1); } + if (!ast_rtp_codecs_get_framing(&newaudiortp)) { + /* Peer did not force us to use a specific framing, so use our own */ + ast_rtp_codecs_set_framing(&newaudiortp, framing); + } + ao2_ref(tmp_fmt, -1); } /* Setup audio address and port */ @@ -11488,6 +11491,7 @@ static int process_sdp_a_audio(const char *a, struct sip_pvt *p, struct ast_rtp_ if (framing && p->autoframing) { ast_debug(1, "Setting framing to %ld\n", framing); ast_format_cap_set_framing(p->caps, framing); + ast_rtp_codecs_set_framing(newaudiortp, framing); } found = TRUE; } else if (sscanf(a, "rtpmap: %30u %127[^/]/%30u", &codec, mimeSubtype, &sample_rate) == 3) { diff --git a/funcs/func_odbc.c b/funcs/func_odbc.c index 0f6b65e7d..0d053f614 100644 --- a/funcs/func_odbc.c +++ b/funcs/func_odbc.c @@ -29,6 +29,7 @@ /*** MODULEINFO <depend>res_odbc</depend> + <depend>generic_odbc</depend> <support_level>core</support_level> ***/ diff --git a/include/asterisk/astosp.h b/include/asterisk/astosp.h deleted file mode 100644 index 4faa2b4e7..000000000 --- a/include/asterisk/astosp.h +++ /dev/null @@ -1,31 +0,0 @@ -/* - * Asterisk -- An open source telephony toolkit. - * - * Copyright (C) 1999 - 2005, Digium, Inc. - * - * Mark Spencer <markster@digium.com> - * - * See http://www.asterisk.org for more information about - * the Asterisk project. Please do not directly contact - * any of the maintainers of this project for assistance; - * the project provides a web site, mailing lists and IRC - * channels for your use. - * - * This program is free software, distributed under the terms of - * the GNU General Public License Version 2. See the LICENSE file - * at the top of the source tree. - */ - -/*! - * \file - * \brief Open Settlement Protocol (OSP) - */ - -#ifndef _ASTERISK_OSP_H -#define _ASTERISK_OSP_H - -#define AST_OSP_SUCCESS ((char*)"SUCCESS") /* Return status, success */ -#define AST_OSP_FAILED ((char*)"FAILED") /* Return status, failed */ -#define AST_OSP_ERROR ((char*)"ERROR") /* Return status, error */ - -#endif /* _ASTERISK_OSP_H */ diff --git a/res/res_config_odbc.c b/res/res_config_odbc.c index 186e89dcd..5d6c2c60a 100644 --- a/res/res_config_odbc.c +++ b/res/res_config_odbc.c @@ -30,6 +30,7 @@ /*** MODULEINFO <depend>res_odbc</depend> + <depend>generic_odbc</depend> <support_level>core</support_level> ***/ diff --git a/res/res_http_post.c b/res/res_http_post.c index 44bb8ee9d..f36b772d4 100644 --- a/res/res_http_post.c +++ b/res/res_http_post.c @@ -36,7 +36,7 @@ #include <sys/stat.h> #include <fcntl.h> #include <gmime/gmime.h> -#if defined (__OpenBSD__) || defined(__FreeBSD__) || defined(__Darwin__) +#if defined (__OpenBSD__) || defined(__FreeBSD__) || defined(__NetBSD__) || defined(__Darwin__) #include <libgen.h> #endif diff --git a/res/res_pjsip_session.c b/res/res_pjsip_session.c index fcd190bcb..f25201731 100644 --- a/res/res_pjsip_session.c +++ b/res/res_pjsip_session.c @@ -876,15 +876,30 @@ static int handle_negotiated_sdp(struct ast_sip_session *session, const pjmedia_ struct ast_stream_topology *topology; unsigned int changed = 0; - /* This situation can legitimately happen when an SDP is received in a - * 183 Session Progress message. In that case, everything's been done - * by the time this function is called and there are no more pending - * streams. - */ if (!session->pending_media_state->topology) { - ast_debug(1, "Pending topology was NULL for channel '%s'\n", - session->channel ? ast_channel_name(session->channel) : "unknown"); - return 0; + if (session->active_media_state->topology) { + /* + * This happens when we have negotiated media after receiving a 183, + * and we're now receiving a 200 with a new SDP. In this case, there + * is active_media_state, but the pending_media_state has been reset. + */ + struct ast_sip_session_media_state *active_media_state_clone; + + active_media_state_clone = + ast_sip_session_media_state_clone(session->active_media_state); + if (!active_media_state_clone) { + ast_log(LOG_WARNING, "Unable to clone active media state for channel '%s'\n", + session->channel ? ast_channel_name(session->channel) : "unknown"); + return -1; + } + + ast_sip_session_media_state_free(session->pending_media_state); + session->pending_media_state = active_media_state_clone; + } else { + ast_log(LOG_WARNING, "No pending or active media state for channel '%s'\n", + session->channel ? ast_channel_name(session->channel) : "unknown"); + return -1; + } } /* If we're handling negotiated streams, then we should already have set |