diff options
-rw-r--r-- | Makefile.rules | 10 | ||||
-rw-r--r-- | apps/app_stasis.c | 12 | ||||
-rw-r--r-- | build_tools/cflags.xml | 5 | ||||
-rw-r--r-- | channels/chan_sip.c | 41 | ||||
-rw-r--r-- | channels/sip/include/dialog.h | 13 | ||||
-rw-r--r-- | menuselect/menuselect.c | 12 | ||||
-rw-r--r-- | menuselect/menuselect.h | 2 | ||||
-rw-r--r-- | menuselect/menuselect_curses.c | 73 | ||||
-rw-r--r-- | third-party/pjproject/Makefile | 95 | ||||
-rw-r--r-- | third-party/pjproject/Makefile.rules | 2 |
10 files changed, 162 insertions, 103 deletions
diff --git a/Makefile.rules b/Makefile.rules index 1031f2def..a22f19c16 100644 --- a/Makefile.rules +++ b/Makefile.rules @@ -103,13 +103,15 @@ CC_LIBS=$(PTHREAD_LIBS) $(LIBS) CXX_LIBS=$(PTHREAD_LIBS) $(LIBS) # determine whether to double-compile so that the optimizer can report code path problems -# this is only done when developer mode and DONT_OPTIMIZE are both enabled -# in that case, we run the preprocessor to produce a .i or .ii file from the source +# In this case, we run the preprocessor to produce a .i or .ii file from the source # code, then compile once with optimizer enabled (and the output to /dev/null), # and if that doesn't fail then compile again with optimizer disabled -ifeq ($(findstring DONT_OPTIMIZE,$(MENUSELECT_CFLAGS))$(AST_DEVMODE),DONT_OPTIMIZEyes) + +ifeq ($(findstring COMPILE_DOUBLE,$(MENUSELECT_CFLAGS)),COMPILE_DOUBLE) COMPILE_DOUBLE=yes -else +endif + +ifeq ($(findstring DONT_OPTIMIZE,$(MENUSELECT_CFLAGS))$(AST_DEVMODE),) _ASTCFLAGS+=$(AST_FORTIFY_SOURCE) endif diff --git a/apps/app_stasis.c b/apps/app_stasis.c index 4f53aff78..1e5b5673c 100644 --- a/apps/app_stasis.c +++ b/apps/app_stasis.c @@ -110,10 +110,16 @@ static int app_exec(struct ast_channel *chan, const char *data) args.app_argv); } - if (ret == -1) { - pbx_builtin_setvar_helper(chan, "STASISSTATUS", "FAILED"); + if (ret) { + /* set ret to 0 so pbx_core doesnt hangup the channel */ + if (!ast_check_hangup(chan)) { + ret = 0; + } else { + ret = -1; + } + pbx_builtin_setvar_helper(chan, "STASISSTATUS", "FAILED"); } else { - pbx_builtin_setvar_helper(chan, "STASISSTATUS", "SUCCESS"); + pbx_builtin_setvar_helper(chan, "STASISSTATUS", "SUCCESS"); } return ret; diff --git a/build_tools/cflags.xml b/build_tools/cflags.xml index ea741531a..d3c3ebe0a 100644 --- a/build_tools/cflags.xml +++ b/build_tools/cflags.xml @@ -1,5 +1,10 @@ <category name="MENUSELECT_CFLAGS" displayname="Compiler Flags" positive_output="yes" remove_on_change=".lastclean"> <member name="DONT_OPTIMIZE" displayname="Disable Optimizations by the Compiler"> + <use autoselect="yes">COMPILE_DOUBLE</use> + <support_level>core</support_level> + </member> + <member name="COMPILE_DOUBLE" displayname="Pre-compile with optimizations to detect errors, then discard and recompile with DONT_OPTIMIZE. Creates intermediate .i files"> + <depend>DONT_OPTIMIZE</depend> <support_level>core</support_level> </member> <member name="DEBUG_THREADS" displayname="Enable Thread Debugging"> diff --git a/channels/chan_sip.c b/channels/chan_sip.c index e467b801d..bbe260f60 100644 --- a/channels/chan_sip.c +++ b/channels/chan_sip.c @@ -6371,11 +6371,14 @@ static void offered_media_list_destroy(struct sip_pvt *p) } } -/*! \brief Execute destruction of SIP dialog structure, release memory */ -void __sip_destroy(struct sip_pvt *p, int lockowner, int lockdialoglist) +/*! \brief ao2 destructor for SIP dialog structure */ +static void sip_pvt_dtor(void *vdoomed) { + struct sip_pvt *p = vdoomed; struct sip_request *req; + ast_debug(3, "Destroying SIP dialog %s\n", p->callid); + /* Destroy Session-Timers if allocated */ if (p->stimer) { p->stimer->quit_flag = 1; @@ -6394,14 +6397,12 @@ void __sip_destroy(struct sip_pvt *p, int lockowner, int lockdialoglist) /* Unlink us from the owner if we have one */ if (p->owner) { - if (lockowner) - ast_channel_lock(p->owner); + ast_channel_lock(p->owner); ast_debug(1, "Detaching from %s\n", ast_channel_name(p->owner)); ast_channel_tech_pvt_set(p->owner, NULL); /* Make sure that the channel knows its backend is going away */ ast_channel_softhangup_internal_flag_add(p->owner, AST_SOFTHANGUP_DEV); - if (lockowner) - ast_channel_unlock(p->owner); + ast_channel_unlock(p->owner); /* Give the channel a chance to react before deallocation */ usleep(1); } @@ -6711,24 +6712,6 @@ static int update_call_counter(struct sip_pvt *fup, int event) return 0; } - -static void sip_destroy_fn(void *p) -{ - sip_destroy(p); -} - -/*! \brief Destroy SIP call structure. - * Make it return NULL so the caller can do things like - * foo = sip_destroy(foo); - * and reduce the chance of bugs due to dangling pointers. - */ -struct sip_pvt *sip_destroy(struct sip_pvt *p) -{ - ast_debug(3, "Destroying SIP dialog %s\n", p->callid); - __sip_destroy(p, TRUE, TRUE); - return NULL; -} - /*! \brief Convert SIP hangup causes to Asterisk hangup causes */ int hangup_sip2cause(int cause) { @@ -8634,7 +8617,7 @@ struct sip_pvt *__sip_alloc(ast_string_field callid, struct ast_sockaddr *addr, { struct sip_pvt *p; - p = __ao2_alloc_debug(sizeof(*p), sip_destroy_fn, + p = __ao2_alloc_debug(sizeof(*p), sip_pvt_dtor, AO2_ALLOC_OPT_LOCK_MUTEX, "allocate a dialog(pvt) struct", file, line, func, 1); if (!p) { @@ -22841,18 +22824,14 @@ static int sip_reinvite_retry(const void *data) struct sip_pvt *p = (struct sip_pvt *) data; struct ast_channel *owner; - sip_pvt_lock(p); /* called from schedule thread which requires a lock */ - while ((owner = p->owner) && ast_channel_trylock(owner)) { - sip_pvt_unlock(p); - usleep(1); - sip_pvt_lock(p); - } + owner = sip_pvt_lock_full(p); ast_set_flag(&p->flags[0], SIP_NEEDREINVITE); p->waitid = -1; check_pendings(p); sip_pvt_unlock(p); if (owner) { ast_channel_unlock(owner); + ast_channel_unref(owner); } dialog_unref(p, "unref the dialog ptr from sip_reinvite_retry, because it held a dialog ptr"); return 0; diff --git a/channels/sip/include/dialog.h b/channels/sip/include/dialog.h index 582841d54..c0dfd605a 100644 --- a/channels/sip/include/dialog.h +++ b/channels/sip/include/dialog.h @@ -43,19 +43,6 @@ void sip_scheddestroy_final(struct sip_pvt *p, int ms); void sip_scheddestroy(struct sip_pvt *p, int ms); int sip_cancel_destroy(struct sip_pvt *p); -/*! \brief Destroy SIP call structure. - * Make it return NULL so the caller can do things like - * foo = sip_destroy(foo); - * and reduce the chance of bugs due to dangling pointers. - */ -struct sip_pvt *sip_destroy(struct sip_pvt *p); - -/*! \brief Destroy SIP call structure. - * Make it return NULL so the caller can do things like - * foo = sip_destroy(foo); - * and reduce the chance of bugs due to dangling pointers. - */ -void __sip_destroy(struct sip_pvt *p, int lockowner, int lockdialoglist); /*! * \brief Unlink a dialog from the dialogs container, as well as any other places * that it may be currently stored. diff --git a/menuselect/menuselect.c b/menuselect/menuselect.c index f4a826b84..6136135aa 100644 --- a/menuselect/menuselect.c +++ b/menuselect/menuselect.c @@ -357,6 +357,10 @@ static int process_xml_ref_node(xmlNode *node, struct member *mem, struct refere } } + if ((tmp = (const char *) xmlGetProp(node, BAD_CAST "autoselect"))) { + ref->autoselect = !strcasecmp(tmp, "yes"); + } + tmp = (const char *) xmlNodeGetContent(node); if (tmp && !strlen_zero(tmp)) { @@ -1154,8 +1158,16 @@ unsigned int enable_member(struct member *mem) } if ((mem->enabled = can_enable)) { + struct reference *use; + print_debug("Just set %s enabled to %d\n", mem->name, mem->enabled); while (calc_dep_failures(1, 0) || calc_conflict_failures(1, 0)); + + AST_LIST_TRAVERSE(&mem->uses, use, list) { + if (use->member && use->autoselect && !use->member->enabled) { + enable_member(use->member); + } + } } return can_enable; diff --git a/menuselect/menuselect.h b/menuselect/menuselect.h index b1d22dd75..112f1c88c 100644 --- a/menuselect/menuselect.h +++ b/menuselect/menuselect.h @@ -43,6 +43,8 @@ struct reference { struct member *member; /*! if this package was found */ unsigned char met:1; + /*! if this package should be autoselected */ + unsigned char autoselect:1; /*! for linking */ AST_LIST_ENTRY(reference) list; }; diff --git a/menuselect/menuselect_curses.c b/menuselect/menuselect_curses.c index 5afa99661..00645927a 100644 --- a/menuselect/menuselect_curses.c +++ b/menuselect/menuselect_curses.c @@ -158,6 +158,12 @@ static int really_quit(WINDOW *win) return c; } +#define MENU_HELP_LEFT_ADJ 16 +#define MAIN_MENU_LEFT_ADJ 20 +#define CAT_MENU_LEFT_ADJ 20 +#define SCROLL_DOWN_LEFT_ADJ 15 +#define MEMBER_INFO_LEFT_ADJ 25 + static void draw_main_menu(WINDOW *menu, int curopt) { struct category *cat; @@ -167,42 +173,67 @@ static void draw_main_menu(WINDOW *menu, int curopt) wclear(menu); AST_LIST_TRAVERSE(&categories, cat, list) { - wmove(menu, i++, max_x / 2 - 10); - snprintf(buf, sizeof(buf), " %s", strlen_zero(cat->displayname) ? cat->name : cat->displayname); + wmove(menu, i++, max_x / 2 - MAIN_MENU_LEFT_ADJ); + snprintf(buf, sizeof(buf), "%s", strlen_zero(cat->displayname) ? cat->name : cat->displayname); waddstr(menu, buf); } - wmove(menu, curopt, (max_x / 2) - 15); + wmove(menu, curopt, (max_x / 2) - MAIN_MENU_LEFT_ADJ - 5); waddstr(menu, "--->"); - wmove(menu, 0, 0); + wmove(menu, curopt, (max_x / 2) - MAIN_MENU_LEFT_ADJ); wrefresh(menu); } -static void display_mem_info(WINDOW *menu, struct member *mem, int start, int end) +static void display_mem_info(WINDOW *menu, struct member *mem, int start_y, int end) { char buf[64]; struct reference *dep; struct reference *con; struct reference *use; + int start_x = (max_x / 2 - MEMBER_INFO_LEFT_ADJ); + int maxlen = (max_x - start_x); - wmove(menu, end - start + 2, max_x / 2 - 16); + wmove(menu, end - start_y + 1, start_x); + wclrtoeol(menu); + wmove(menu, end - start_y + 2, start_x); wclrtoeol(menu); - wmove(menu, end - start + 3, max_x / 2 - 16); + wmove(menu, end - start_y + 3, start_x); wclrtoeol(menu); - wmove(menu, end - start + 4, max_x / 2 - 16); + wmove(menu, end - start_y + 4, start_x); wclrtoeol(menu); - wmove(menu, end - start + 5, max_x / 2 - 16); + wmove(menu, end - start_y + 5, start_x); wclrtoeol(menu); - wmove(menu, end - start + 6, max_x / 2 - 16); + wmove(menu, end - start_y + 6, start_x); wclrtoeol(menu); if (mem->displayname) { - wmove(menu, end - start + 2, max_x / 2 - 16); - waddstr(menu, (char *) mem->displayname); + int name_len = strlen(mem->displayname); + + wmove(menu, end - start_y + 1, start_x); + if (name_len > maxlen) { + char *last_space; + char *line_1 = strdup(mem->displayname); + + if (line_1) { + line_1[maxlen] = '\0'; + last_space = strrchr(line_1, ' '); + if (last_space) { + *last_space = '\0'; + } + waddstr(menu, line_1); + wmove(menu, end - start_y + 2, start_x); + waddstr(menu, &mem->displayname[last_space - line_1]); + free(line_1); + } else { + waddstr(menu, (char *) mem->displayname); + } + } else { + waddstr(menu, (char *) mem->displayname); + } } if (!AST_LIST_EMPTY(&mem->deps)) { - wmove(menu, end - start + 3, max_x / 2 - 16); + wmove(menu, end - start_y + 3, start_x); strcpy(buf, "Depends on: "); AST_LIST_TRAVERSE(&mem->deps, dep, list) { strncat(buf, dep->displayname, sizeof(buf) - strlen(buf) - 1); @@ -213,7 +244,7 @@ static void display_mem_info(WINDOW *menu, struct member *mem, int start, int en waddstr(menu, buf); } if (!AST_LIST_EMPTY(&mem->uses)) { - wmove(menu, end - start + 4, max_x / 2 - 16); + wmove(menu, end - start_y + 4, start_x); strcpy(buf, "Can use: "); AST_LIST_TRAVERSE(&mem->uses, use, list) { strncat(buf, use->displayname, sizeof(buf) - strlen(buf) - 1); @@ -224,7 +255,7 @@ static void display_mem_info(WINDOW *menu, struct member *mem, int start, int en waddstr(menu, buf); } if (!AST_LIST_EMPTY(&mem->conflicts)) { - wmove(menu, end - start + 5, max_x / 2 - 16); + wmove(menu, end - start_y + 5, start_x); strcpy(buf, "Conflicts with: "); AST_LIST_TRAVERSE(&mem->conflicts, con, list) { strncat(buf, con->displayname, sizeof(buf) - strlen(buf) - 1); @@ -237,7 +268,7 @@ static void display_mem_info(WINDOW *menu, struct member *mem, int start, int en if (!mem->is_separator) { /* Separators lack support levels */ { /* support level */ - wmove(menu, end - start + 6, max_x / 2 - 16); + wmove(menu, end - start_y + 6, start_x); snprintf(buf, sizeof(buf), "Support Level: %s", mem->support_level); if (mem->replacement && *mem->replacement) { char buf2[64]; @@ -266,7 +297,7 @@ static void draw_category_menu(WINDOW *menu, struct category *cat, int start, in break; } } - wmove(menu, curopt - start, max_x / 2 - 9); + wmove(menu, curopt - start, (max_x / 2) - (CAT_MENU_LEFT_ADJ - 1)); wrefresh(menu); return; } @@ -279,7 +310,7 @@ static void draw_category_menu(WINDOW *menu, struct category *cat, int start, in i++; continue; } - wmove(menu, j++, max_x / 2 - 10); + wmove(menu, j++, max_x / 2 - CAT_MENU_LEFT_ADJ); i++; if ((mem->depsfailed == HARD_FAILURE) || (mem->conflictsfailed == HARD_FAILURE)) { snprintf(buf, sizeof(buf), "XXX %s", mem->name); @@ -302,11 +333,11 @@ static void draw_category_menu(WINDOW *menu, struct category *cat, int start, in } if (flags & SCROLL_DOWN) { - wmove(menu, j, max_x / 2 - sizeof(SCROLL_DOWN_INDICATOR) / 2); + wmove(menu, j, max_x / 2 - SCROLL_DOWN_LEFT_ADJ); waddstr(menu, SCROLL_DOWN_INDICATOR); } - wmove(menu, curopt - start, max_x / 2 - 9); + wmove(menu, curopt - start, (max_x / 2) - (CAT_MENU_LEFT_ADJ - 1)); wrefresh(menu); } @@ -465,7 +496,7 @@ static void draw_title_window(WINDOW *title) waddstr(title, (char *) menu_name); wmove(title, 3, (max_x / 2) - (strlen(titlebar) / 2)); waddstr(title, titlebar); - wmove(title, 5, (max_x / 2) - (strlen(MENU_HELP) / 2)); + wmove(title, 5, (max_x / 2) - MENU_HELP_LEFT_ADJ); waddstr(title, MENU_HELP); wrefresh(title); } diff --git a/third-party/pjproject/Makefile b/third-party/pjproject/Makefile index 310095159..5810a65dc 100644 --- a/third-party/pjproject/Makefile +++ b/third-party/pjproject/Makefile @@ -1,59 +1,87 @@ .SUFFIXES: .PHONY: _all all _install install clean distclean echo_cflags configure -ifeq ($(MAKECMDGOALS),install) -include ../../makeopts -else --include ../../makeopts -endif - include ../versions.mak -include ../Makefile.rules -include Makefile.rules -ECHO_PREFIX := $(ECHO_PREFIX) echo '[pjproject] ' +SPECIAL_TARGETS := -ifeq ($(MAKECMDGOALS),echo_cflags) --include build.mak -ECHO_PREFIX=@\# +ifneq ($(findstring configure,$(MAKECMDGOALS))$(findstring echo_cflags,$(MAKECMDGOALS)),) +# Run from $(ASTTOPDIR)/configure + SPECIAL_TARGETS += configure + include ../Makefile.rules + include Makefile.rules endif -ifneq ($(PJPROJECT_BUNDLED),yes) -all install: - @echo '[pjproject] Not enabled' -else +ifeq ($(findstring echo_cflags,$(MAKECMDGOALS)),echo_cflags) + -include build.mak + ECHO_PREFIX=@\# +endif -ifneq ($(findstring clean,$(MAKECMDGOALS)),clean) -include build.mak +ifeq ($(findstring clean,$(MAKECMDGOALS)),clean) +# clean or distclean + SPECIAL_TARGETS += clean + include ../Makefile.rules + include Makefile.rules endif -all: _all -install: _install +ifeq ($(SPECIAL_TARGETS),) +# Run locally or from $(ASTTOPDIR)/Makefile. All include files should be present + ifeq ($(wildcard ../../makeopts),) + $(error ASTTOPDIR/configure hasn't been run) + endif + include ../../makeopts + + ifeq ($(PJPROJECT_BUNDLED),yes) + -include ../../menuselect.makeopts + include ../Makefile.rules + + all: _all + install: _install + + include ../../Makefile.rules + include Makefile.rules + include build.mak + CF := $(filter-out -W%,$(CC_CFLAGS)) + CF := $(filter-out -I%,$(CF)) + export CFLAGS += $(CF) + export LDFLAGS += $(CC_LDFLAGS) + else + all install: + endif endif +ECHO_PREFIX := $(ECHO_PREFIX) echo '[pjproject] ' + ifndef $(TMPDIR) -ifneq ($(wildcard /tmp),) -TMPDIR=/tmp -else -TMPDIR=. -endif + ifneq ($(wildcard /tmp),) + TMPDIR=/tmp + else + TMPDIR=. + endif endif $(TMPDIR)/pjproject-$(PJPROJECT_VERSION).tar.bz2 : ../versions.mak $(ECHO_PREFIX) Downloading $@ with $(DOWNLOAD) $(CMD_PREFIX) $(DOWNLOAD) $(PJPROJECT_URL)/$(@F) > $@ -source/user.mak source/pjlib/include/pj/config_site.h: $(TMPDIR)/pjproject-$(PJPROJECT_VERSION).tar.bz2 patches/config_site.h patches/user.mak +source/.unpacked: $(TMPDIR)/pjproject-$(PJPROJECT_VERSION).tar.bz2 $(ECHO_PREFIX) Unpacking $< -@rm -rf source &>/dev/null -@mkdir source &>/dev/null $(CMD_PREFIX) tar --strip-components=1 -C source -xjf $< - $(ECHO_PREFIX) Applying patches and custom files + $(ECHO_PREFIX) Applying patches $(CMD_PREFIX) ./apply_patches $(QUIET_CONFIGURE) ./patches ./source - $(CMD_PREFIX) cp -f ./patches/config_site.h ./source/pjlib/include/pj/ + -@touch source/.unpacked + +source/user.mak: source/.unpacked ./patches/user.mak + $(ECHO_PREFIX) Applying user.mak $(CMD_PREFIX) cp -f ./patches/user.mak ./source/ -build.mak: source/pjlib/include/pj/config_site.h source/user.mak Makefile.rules +source/pjlib/include/pj/config_site.h: source/.unpacked ./patches/config_site.h + $(ECHO_PREFIX) Applying config_site.h + $(CMD_PREFIX) cp -f ./patches/config_site.h ./source/pjlib/include/pj/ + +build.mak: source/.unpacked source/pjlib/include/pj/config_site.h source/user.mak Makefile.rules $(ECHO_PREFIX) Configuring with $(PJPROJECT_CONFIG_OPTS) $(CMD_PREFIX) (cd source ; autoconf aconfigure.ac > aconfigure && ./aconfigure $(QUIET_CONFIGURE) $(PJPROJECT_CONFIG_OPTS)) @sed -r -e "/prefix|export PJ_SHARED_LIBRARIES|MACHINE_NAME|OS_NAME|HOST_NAME|CC_NAME|CROSS_COMPILE|LINUX_POLL/d" source/build.mak > build.mak @@ -67,7 +95,13 @@ source/pjlib/build/.pjlib-$(TARGET_NAME).depend: build.mak $(ECHO_PREFIX) "Making dependencies" +$(CMD_PREFIX) $(SUBMAKE) -C source dep -source/pjlib/lib/libpj-$(TARGET_NAME).a: source/pjlib/build/.pjlib-$(TARGET_NAME).depend + +menuselect: ../../menuselect.makeopts ../../makeopts + -$(CMD_PREFIX) test -d source && ($(SUBMAKE) -C source clean ; find source -name *.a -delete ; rm -rf source/pjsip-apps/src/python/build) || : + -$(CMD_PREFIX) rm -rf pjproject.symbols + + +source/pjlib/lib/libpj-$(TARGET_NAME).a: menuselect source/pjlib/build/.pjlib-$(TARGET_NAME).depend $(ECHO_PREFIX) Compiling libs +$(CMD_PREFIX) $(SUBMAKE) -C source lib $(REALLY_QUIET) @@ -83,6 +117,7 @@ source/pjsip-apps/src/python/build/_pjsua.so: source/pjlib/lib/libpj-$(TARGET_NA $(ECHO_PREFIX) Compiling python bindings $(CMD_PREFIX) (cd source/pjsip-apps/src/python ; python setup.py build --build-platlib=./build $(REALLY_QUIET)) + _all: pjproject.symbols source/pjsip-apps/bin/pjsua-$(TARGET_NAME) source/pjsip-apps/src/python/build/_pjsua.so _install: _all diff --git a/third-party/pjproject/Makefile.rules b/third-party/pjproject/Makefile.rules index 6319ed516..f39629b92 100644 --- a/third-party/pjproject/Makefile.rules +++ b/third-party/pjproject/Makefile.rules @@ -2,6 +2,6 @@ PJPROJECT_URL = http://www.pjsip.org/release/$(PJPROJECT_VERSION) # Even though we're not installing pjproject, we're setting prefix to /opt/pjproject to be safe PJPROJECT_CONFIG_OPTS = --prefix=/opt/pjproject --with-external-speex --with-external-gsm --with-external-srtp \ - --disable-video --disable-v4l2 --disable-sound --disable-resample \ + --with-external-pa --disable-video --disable-v4l2 --disable-sound \ --disable-opencore-amr --disable-ilbc-codec --without-libyuv --disable-g7221-codec \ --enable-epoll |