]> git.ipfire.org Git - thirdparty/asterisk.git/commitdiff
From a user complaint on #asterisk, I have forced pbx_spool to explain what reason...
authorSteve Murphy <murf@digium.com>
Fri, 10 Aug 2007 20:53:43 +0000 (20:53 +0000)
committerSteve Murphy <murf@digium.com>
Fri, 10 Aug 2007 20:53:43 +0000 (20:53 +0000)
git-svn-id: https://origsvn.digium.com/svn/asterisk/branches/1.4@79099 65c4cc65-6c06-0410-ace0-fbb531ad65f3

include/asterisk/channel.h
main/channel.c
pbx/pbx_spool.c

index d54b307094992b1935229054daf4d3d70f37b51f..063d325ef247335f26d3fd48887e9b1d2f9033e2 100644 (file)
@@ -1365,6 +1365,16 @@ int ast_channel_whisper_feed(struct ast_channel *chan, struct ast_frame *f);
  */
 void ast_channel_whisper_stop(struct ast_channel *chan);
 
+
+
+/*!
+  \brief return an english explanation of the code returned thru __ast_request_and_dial's 'outstate' argument
+  \param reason  The integer argument, usually taken from AST_CONTROL_ macros
+  \return char pointer explaining the code
+ */
+char *ast_channel_reason2str(int reason);
+
+
 #if defined(__cplusplus) || defined(c_plusplus)
 }
 #endif
index e034eaa7d22d3b9ac5dfea26ac494e18904b1c52..8e12e147452a1ca9fb8215e7095b45a2101785c3 100644 (file)
@@ -3034,6 +3034,29 @@ int ast_set_write_format(struct ast_channel *chan, int fmt)
                          &chan->writetrans, 1);
 }
 
+char *ast_channel_reason2str(int reason)
+{
+       switch (reason) /* the following appear to be the only ones actually returned by request_and_dial */
+       {
+       case 0:
+               return "Call Failure (not BUSY, and not NO_ANSWER, maybe Circuit busy or down?)";
+       case AST_CONTROL_HANGUP:
+               return "Hangup";
+       case AST_CONTROL_RING:
+               return "Local Ring";
+       case AST_CONTROL_RINGING:
+               return "Remote end Ringing";
+       case AST_CONTROL_ANSWER:
+               return "Remote end has Answered";
+       case AST_CONTROL_BUSY:
+               return "Remote end is Busy";
+       case AST_CONTROL_CONGESTION:
+               return "Congestion (circuits busy)";
+       default:
+               return "Unknown Reason!!";
+       }
+}
+
 struct ast_channel *__ast_request_and_dial(const char *type, int format, void *data, int timeout, int *outstate, const char *cid_num, const char *cid_name, struct outgoing_helper *oh)
 {
        int dummy_outstate;
index 853f6a3599752c6eedffe0db12aab6e7123c2158..fe29127ea479a36039b615086b8600240065b66c 100644 (file)
@@ -338,7 +338,7 @@ static void *attempt_thread(void *data)
                res = ast_pbx_outgoing_exten(o->tech, AST_FORMAT_SLINEAR, o->dest, o->waittime * 1000, o->context, o->exten, o->priority, &reason, 2 /* wait to finish */, o->cid_num, o->cid_name, o->vars, o->account, NULL);
        }
        if (res) {
-               ast_log(LOG_NOTICE, "Call failed to go through, reason %d\n", reason);
+               ast_log(LOG_NOTICE, "Call failed to go through, reason (%d) %s\n", reason, ast_channel_reason2str(reason));
                if (o->retries >= o->maxretries + 1) {
                        /* Max retries exceeded */
                        ast_log(LOG_EVENT, "Queued call to %s/%s expired without completion after %d attempt%s\n", o->tech, o->dest, o->retries - 1, ((o->retries - 1) != 1) ? "s" : "");