Merge "StatsD: Send stuff to the StatsD server and test"
authorJoshua Colp <jcolp@digium.com>
Mon, 2 Nov 2015 21:11:09 +0000 (15:11 -0600)
committerGerrit Code Review <gerrit2@gerrit.digium.api>
Mon, 2 Nov 2015 21:11:10 +0000 (15:11 -0600)
CHANGES
Makefile
apps/app_queue.c

diff --git a/CHANGES b/CHANGES
index 1dff204..78d5e6b 100644 (file)
--- a/CHANGES
+++ b/CHANGES
@@ -191,6 +191,10 @@ cdr_adaptive_odbc
    names. This setting is configurable for cdr_adaptive_odbc via the
    quoted_identifiers in configuration file cdr_adaptive_odbc.conf.
 
+Queue
+-------------------
+ * Added field ReasonPause on QueueMemberStatus if set when paused, the reason
+   the queue member was paused.
 
 ------------------------------------------------------------------------------
 --- Functionality changes from Asterisk 13.6.0 to Asterisk 13.7.0 ------------
index bfa1ad9..5bc6570 100644 (file)
--- a/Makefile
+++ b/Makefile
@@ -124,7 +124,7 @@ empty:=
 space:=$(empty) $(empty)
 ASTTOPDIR:=$(subst $(space),\$(space),$(CURDIR))
 
-# Overwite config files on "make samples"
+# Overwite config files on "make samples" or other config installation targets
 OVERWRITE=y
 
 # Include debug and macro symbols in the executables (-g) and profiling info (-pg)
@@ -651,7 +651,12 @@ install: badshell bininstall datafiles
        @echo " + configuration files (overwriting any      +"
        @echo " + existing config files), run:              +"
        @echo " +                                           +"
-       @echo " +               $(mK) samples               +"
+       @echo " + For generic reference documentation:      +"
+       @echo " +   $(mK) samples                           +"
+       @echo " +                                           +"
+       @echo " + For a sample basic PBX:                   +"
+       @echo " +   $(mK) basic-pbx                         +"
+       @echo " +                                           +"
        @echo " +                                           +"
        @echo " +-----------------  or ---------------------+"
        @echo " +                                           +"
@@ -669,24 +674,14 @@ isntall: install
 
 upgrade: bininstall
 
-# XXX why *.adsi is installed first ?
-adsi:
-       @echo Installing adsi config files...
-       $(INSTALL) -d "$(DESTDIR)$(ASTETCDIR)"
-       @for x in configs/samples/*.adsi; do \
-               dst="$(DESTDIR)$(ASTETCDIR)/`$(BASENAME) $$x`" ; \
-               if [ -f "$${dst}" ] ; then \
-                       echo "Overwriting $$x" ; \
-               else \
-                       echo "Installing $$x" ; \
-               fi ; \
-               $(INSTALL) -m 644 "$$x" "$(DESTDIR)$(ASTETCDIR)/`$(BASENAME) $$x`" ; \
-       done
 
-samples: adsi
-       @echo Installing other config files...
-       @for x in configs/samples/*.sample; do \
-               dst="$(DESTDIR)$(ASTETCDIR)/`$(BASENAME) $$x .sample`" ;        \
+# Install configuration files from the specified directory
+# Parameters:
+#  (1) the configuration directory to install from
+#  (2) the extension to strip off
+define INSTALL_CONFIGS
+       @for x in configs/$(1)/*$(2); do \
+               dst="$(DESTDIR)$(ASTETCDIR)/`$(BASENAME) $$x $(2)`"; \
                if [ -f "$${dst}" ]; then \
                        if [ "$(OVERWRITE)" = "y" ]; then \
                                if cmp -s "$${dst}" "$$x" ; then \
@@ -701,7 +696,7 @@ samples: adsi
                fi ; \
                echo "Installing file $$x"; \
                $(INSTALL) -m 644 "$$x" "$${dst}" ;\
-       done
+       done ; \
        if [ "$(OVERWRITE)" = "y" ]; then \
                echo "Updating asterisk.conf" ; \
                sed -e 's|^astetcdir.*$$|astetcdir => $(ASTETCDIR)|' \
@@ -718,10 +713,28 @@ samples: adsi
                        "$(DESTDIR)$(ASTCONFPATH)" > "$(DESTDIR)$(ASTCONFPATH).tmp" ; \
                $(INSTALL) -m 644 "$(DESTDIR)$(ASTCONFPATH).tmp" "$(DESTDIR)$(ASTCONFPATH)" ; \
                rm -f "$(DESTDIR)$(ASTCONFPATH).tmp" ; \
-       fi ; \
+       fi
+endef
+
+# XXX why *.adsi is installed first ?
+adsi:
+       @echo Installing adsi config files...
+       $(INSTALL) -d "$(DESTDIR)$(ASTETCDIR)"
+       @for x in configs/samples/*.adsi; do \
+               dst="$(DESTDIR)$(ASTETCDIR)/`$(BASENAME) $$x`" ; \
+               if [ -f "$${dst}" ] ; then \
+                       echo "Overwriting $$x" ; \
+               else \
+                       echo "Installing $$x" ; \
+               fi ; \
+               $(INSTALL) -m 644 "$$x" "$(DESTDIR)$(ASTETCDIR)/`$(BASENAME) $$x`" ; \
+       done
+
+samples: adsi
+       @echo Installing other config files...
+       $(call INSTALL_CONFIGS,samples,.sample)
        $(INSTALL) -d "$(DESTDIR)$(ASTSPOOLDIR)/voicemail/default/1234/INBOX"
        build_tools/make_sample_voicemail "$(DESTDIR)/$(ASTDATADIR)" "$(DESTDIR)/$(ASTSPOOLDIR)"
-
        @for x in phoneprov/*; do \
                dst="$(DESTDIR)$(ASTDATADIR)/$$x" ;     \
                if [ -f "$${dst}" ]; then \
@@ -740,6 +753,10 @@ samples: adsi
                $(INSTALL) -m 644 "$$x" "$${dst}" ;\
        done
 
+basic-pbx:
+       @echo Installing basic-pbx config files...
+       $(call INSTALL_CONFIGS,basic-pbx)
+
 webvmail:
        @[ -d "$(DESTDIR)$(HTTP_DOCSDIR)/" ] || ( printf "http docs directory not found.\nUpdate assignment of variable HTTP_DOCSDIR in Makefile!\n" && exit 1 )
        @[ -d "$(DESTDIR)$(HTTP_CGIDIR)" ] || ( printf "cgi-bin directory not found.\nUpdate assignment of variable HTTP_CGIDIR in Makefile!\n" && exit 1 )
@@ -1012,6 +1029,7 @@ endif
 .PHONY: validate-docs
 .PHONY: _clean
 .PHONY: ari-stubs
+.PHONY: basic-pbx
 .PHONY: $(SUBDIRS_INSTALL)
 .PHONY: $(SUBDIRS_DIST_CLEAN)
 .PHONY: $(SUBDIRS_CLEAN)
index e043e18..862988b 100644 (file)
@@ -1043,6 +1043,9 @@ ASTERISK_REGISTER_FILE()
                                                <enum name="1"/>
                                        </enumlist>
                                </parameter>
+                               <parameter name="PausedReason">
+                                       <para>If set when paused, the reason the queue member was paused.</para>
+                               </parameter>
                                <parameter name="Ringinuse">
                                        <enumlist>
                                                <enum name="0"/>
@@ -1534,6 +1537,7 @@ struct member {
        int realtime;                        /*!< Is this member realtime? */
        int status;                          /*!< Status of queue member */
        int paused;                          /*!< Are we paused (not accepting calls)? */
+       char reason_paused[80];              /*!< Reason of paused if member is paused */
        int queuepos;                        /*!< In what order (pertains to certain strategies) should this member be called? */
        time_t lastcall;                     /*!< When last successful call was hungup */
        struct call_queue *lastqueue;        /*!< Last queue we received a call */
@@ -2173,7 +2177,7 @@ static void queue_publish_member_blob(struct stasis_message_type *type, struct a
 
 static struct ast_json *queue_member_blob_create(struct call_queue *q, struct member *mem)
 {
-       return ast_json_pack("{s: s, s: s, s: s, s: s, s: s, s: i, s: i, s: i, s: i, s: i, s: i}",
+       return ast_json_pack("{s: s, s: s, s: s, s: s, s: s, s: i, s: i, s: i, s: i, s: i, s: s, s: i}",
                "Queue", q->name,
                "MemberName", mem->membername,
                "Interface", mem->interface,
@@ -2184,6 +2188,7 @@ static struct ast_json *queue_member_blob_create(struct call_queue *q, struct me
                "LastCall", (int)mem->lastcall,
                "Status", mem->status,
                "Paused", mem->paused,
+               "PausedReason", mem->reason_paused,
                "Ringinuse", mem->ringinuse);
 }
 
@@ -7069,6 +7074,14 @@ static void set_queue_member_pause(struct call_queue *q, struct member *mem, con
        }
 
        mem->paused = paused;
+       if (paused) {
+               if (!ast_strlen_zero(reason)) {
+                       ast_copy_string(mem->reason_paused, reason, sizeof(mem->reason_paused));
+               }
+       } else {
+               ast_copy_string(mem->reason_paused, "", sizeof(mem->reason_paused));
+       }
+
        ast_devstate_changed(mem->paused ? QUEUE_PAUSED_DEVSTATE : QUEUE_UNPAUSED_DEVSTATE,
                AST_DEVSTATE_CACHABLE, "Queue:%s_pause_%s", q->name, mem->interface);
 
@@ -9611,10 +9624,11 @@ static int manager_queues_status(struct mansession *s, const struct message *m)
                                                "LastCall: %d\r\n"
                                                "Status: %d\r\n"
                                                "Paused: %d\r\n"
+                                               "PausedReason: %s\r\n"
                                                "%s"
                                                "\r\n",
                                                q->name, mem->membername, mem->interface, mem->state_interface, mem->dynamic ? "dynamic" : "static",
-                                               mem->penalty, mem->calls, (int)mem->lastcall, mem->status, mem->paused, idText);
+                                               mem->penalty, mem->calls, (int)mem->lastcall, mem->status, mem->paused, mem->reason_paused, idText);
                                        ++q_items;
                                }
                                ao2_ref(mem, -1);
@@ -9768,7 +9782,7 @@ static int manager_pause_queue_member(struct mansession *s, const struct message
        interface = astman_get_header(m, "Interface");
        paused_s = astman_get_header(m, "Paused");
        queuename = astman_get_header(m, "Queue");      /* Optional - if not supplied, pause the given Interface in all queues */
-       reason = astman_get_header(m, "Reason");        /* Optional - Only used for logging purposes */
+       reason = astman_get_header(m, "Reason");        /* Optional */
 
        if (ast_strlen_zero(interface) || ast_strlen_zero(paused_s)) {
                astman_send_error(s, m, "Need 'Interface' and 'Paused' parameters.");