No subject
Thu Jul 12 09:23:04 CDT 2007
........
Modified:
trunk/include/asterisk/channel.h
trunk/main/channel.c
trunk/pbx/pbx_spool.c
Modified: trunk/include/asterisk/channel.h
URL: http://svn.digium.com/view/asterisk/trunk/include/asterisk/channel.h?view=diff&rev=79100&r1=79099&r2=79100
==============================================================================
--- trunk/include/asterisk/channel.h (original)
+++ trunk/include/asterisk/channel.h Fri Aug 10 16:03:06 2007
@@ -1458,6 +1458,16 @@
*/
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
Modified: trunk/main/channel.c
URL: http://svn.digium.com/view/asterisk/trunk/main/channel.c?view=diff&rev=79100&r1=79099&r2=79100
==============================================================================
--- trunk/main/channel.c (original)
+++ trunk/main/channel.c Fri Aug 10 16:03:06 2007
@@ -2919,6 +2919,29 @@
&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;
Modified: trunk/pbx/pbx_spool.c
URL: http://svn.digium.com/view/asterisk/trunk/pbx/pbx_spool.c?view=diff&rev=79100&r1=79099&r2=79100
==============================================================================
--- trunk/pbx/pbx_spool.c (original)
+++ trunk/pbx/pbx_spool.c Fri Aug 10 16:03:06 2007
@@ -336,7 +336,7 @@
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" : "");
More information about the asterisk-commits
mailing list