aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rwxr-xr-xapps/app_dial.c2
-rwxr-xr-xchannel.c63
-rwxr-xr-xchannels/chan_mgcp.c4
-rwxr-xr-xchannels/chan_sip.c8
-rwxr-xr-xchannels/chan_skinny.c4
-rwxr-xr-xchannels/chan_zap.c4
-rwxr-xr-xinclude/asterisk/channel.h11
7 files changed, 84 insertions, 12 deletions
diff --git a/apps/app_dial.c b/apps/app_dial.c
index e9976375a..333017e04 100755
--- a/apps/app_dial.c
+++ b/apps/app_dial.c
@@ -974,7 +974,7 @@ static int dial_exec_full(struct ast_channel *chan, void *data, struct ast_flags
tmp->chan = ast_request(tech, chan->nativeformats, numsubst, &cause);
if (!tmp->chan) {
/* If we can't, just go on to the next call */
- ast_log(LOG_NOTICE, "Unable to create channel of type '%s' (cause %d)\n", tech, cause);
+ ast_log(LOG_NOTICE, "Unable to create channel of type '%s' (cause %d - %s)\n", tech, cause, ast_cause2str(cause));
HANDLE_CAUSE(cause, chan);
cur = rest;
continue;
diff --git a/channel.c b/channel.c
index 0a0fecb6e..25162c5b8 100755
--- a/channel.c
+++ b/channel.c
@@ -91,6 +91,57 @@ static struct ast_channel *channels = NULL;
*/
AST_MUTEX_DEFINE_STATIC(chlock);
+const struct ast_cause {
+ int cause;
+ const char *desc;
+} causes[] = {
+ { AST_CAUSE_UNALLOCATED, "Unallocated (unassigned) number" },
+ { AST_CAUSE_NO_ROUTE_TRANSIT_NET, "No route to specified transmit network" },
+ { AST_CAUSE_NO_ROUTE_DESTINATION, "No route to destination" },
+ { AST_CAUSE_CHANNEL_UNACCEPTABLE, "Channel unacceptable" },
+ { AST_CAUSE_CALL_AWARDED_DELIVERED, "Call awarded and being delivered in an established channel" },
+ { AST_CAUSE_NORMAL_CLEARING, "Normal Clearing" },
+ { AST_CAUSE_USER_BUSY, "User busy" },
+ { AST_CAUSE_NO_USER_RESPONSE, "No user responding" },
+ { AST_CAUSE_NO_ANSWER, "User alerting, no answer" },
+ { AST_CAUSE_CALL_REJECTED, "Call Rejected" },
+ { AST_CAUSE_NUMBER_CHANGED, "Number changed" },
+ { AST_CAUSE_DESTINATION_OUT_OF_ORDER, "Destination out of order" },
+ { AST_CAUSE_INVALID_NUMBER_FORMAT, "Invalid number format" },
+ { AST_CAUSE_FACILITY_REJECTED, "Facility rejected" },
+ { AST_CAUSE_RESPONSE_TO_STATUS_ENQUIRY, "Response to STATus ENQuiry" },
+ { AST_CAUSE_NORMAL_UNSPECIFIED, "Normal, unspecified" },
+ { AST_CAUSE_NORMAL_CIRCUIT_CONGESTION, "Circuit/channel congestion" },
+ { AST_CAUSE_NETWORK_OUT_OF_ORDER, "Network out of order" },
+ { AST_CAUSE_NORMAL_TEMPORARY_FAILURE, "Temporary failure" },
+ { AST_CAUSE_SWITCH_CONGESTION, "Switching equipment congestion" },
+ { AST_CAUSE_ACCESS_INFO_DISCARDED, "Access information discarded" },
+ { AST_CAUSE_REQUESTED_CHAN_UNAVAIL, "Requested channel not available" },
+ { AST_CAUSE_PRE_EMPTED, "Pre-empted" },
+ { AST_CAUSE_FACILITY_NOT_SUBSCRIBED, "Facility not subscribed" },
+ { AST_CAUSE_OUTGOING_CALL_BARRED, "Outgoing call barred" },
+ { AST_CAUSE_INCOMING_CALL_BARRED, "Incoming call barred" },
+ { AST_CAUSE_BEARERCAPABILITY_NOTAUTH, "Bearer capability not authorized" },
+ { AST_CAUSE_BEARERCAPABILITY_NOTAVAIL, "Bearer capability not available" },
+ { AST_CAUSE_BEARERCAPABILITY_NOTIMPL, "Bearer capability not implemented" },
+ { AST_CAUSE_CHAN_NOT_IMPLEMENTED, "Channel not implemented" },
+ { AST_CAUSE_FACILITY_NOT_IMPLEMENTED, "Facility not implemented" },
+ { AST_CAUSE_INVALID_CALL_REFERENCE, "Invalid call reference value" },
+ { AST_CAUSE_INCOMPATIBLE_DESTINATION, "Incompatible destination" },
+ { AST_CAUSE_INVALID_MSG_UNSPECIFIED, "Invalid message unspecified" },
+ { AST_CAUSE_MANDATORY_IE_MISSING, "Mandatory information element is missing" },
+ { AST_CAUSE_MESSAGE_TYPE_NONEXIST, "Message type nonexist." },
+ { AST_CAUSE_WRONG_MESSAGE, "Wrong message" },
+ { AST_CAUSE_IE_NONEXIST, "Info. element nonexist or not implemented" },
+ { AST_CAUSE_INVALID_IE_CONTENTS, "Invalid information element contents" },
+ { AST_CAUSE_WRONG_CALL_STATE, "Message not compatible with call state" },
+ { AST_CAUSE_RECOVERY_ON_TIMER_EXPIRE, "Recover on timer expiry" },
+ { AST_CAUSE_MANDATORY_IE_LENGTH_ERROR, "Mandatory IE length error" },
+ { AST_CAUSE_PROTOCOL_ERROR, "Protocol error, unspecified" },
+ { AST_CAUSE_INTERWORKING, "Interworking, unspecified" },
+};
+
+
static int show_channeltypes(int fd, int argc, char *argv[])
{
#define FORMAT "%-10.10s %-50.50s %-12.12s\n"
@@ -244,6 +295,18 @@ int ast_channel_register(const struct ast_channel_tech *tech)
return 0;
}
+/*--- ast_cause2str: Gives the string form of a given hangup cause */
+const char *ast_cause2str(int cause)
+{
+ int x;
+
+ for (x=0; x < sizeof(causes) / sizeof(causes[0]); x++)
+ if (causes[x].cause == cause)
+ return causes[x].desc;
+
+ return "Unknown";
+}
+
/*--- ast_state2str: Gives the string form of a given channel state */
char *ast_state2str(int state)
{
diff --git a/channels/chan_mgcp.c b/channels/chan_mgcp.c
index 1b5dd6358..9cf875409 100755
--- a/channels/chan_mgcp.c
+++ b/channels/chan_mgcp.c
@@ -164,7 +164,7 @@ static char *mgcp_cxmodes[] = {
static char context[AST_MAX_EXTENSION] = "default";
static char language[MAX_LANGUAGE] = "";
-static char musicclass[MAX_LANGUAGE] = "";
+static char musicclass[MAX_MUSICCLASS] = "";
static char cid_num[AST_MAX_EXTENSION] = "";
static char cid_name[AST_MAX_EXTENSION] = "";
@@ -375,7 +375,7 @@ struct mgcp_endpoint {
char lastcallerid[AST_MAX_EXTENSION]; /* Last Caller*ID */
char call_forward[AST_MAX_EXTENSION]; /* Last Caller*ID */
char mailbox[AST_MAX_EXTENSION];
- char musicclass[MAX_LANGUAGE];
+ char musicclass[MAX_MUSICCLASS];
char curtone[80]; /* Current tone */
ast_group_t callgroup;
ast_group_t pickupgroup;
diff --git a/channels/chan_sip.c b/channels/chan_sip.c
index ba6428156..6b4e40d21 100755
--- a/channels/chan_sip.c
+++ b/channels/chan_sip.c
@@ -347,7 +347,7 @@ static int compactheaders = 0; /* send compact sip headers */
static int recordhistory = 0; /* Record SIP history. Off by default */
-static char global_musicclass[MAX_LANGUAGE] = ""; /* Global music on hold class */
+static char global_musicclass[MAX_MUSICCLASS] = ""; /* Global music on hold class */
#define DEFAULT_REALM "asterisk"
static char global_realm[MAXHOSTNAMELEN] = DEFAULT_REALM; /* Default realm */
static char regcontext[AST_MAX_EXTENSION] = ""; /* Context for auto-extensions */
@@ -521,7 +521,7 @@ static struct sip_pvt {
char fromname[AST_MAX_EXTENSION]; /* Name to show in the user field */
char tohost[MAXHOSTNAMELEN]; /* Host we should put in the "to" field */
char language[MAX_LANGUAGE]; /* Default language for this call */
- char musicclass[MAX_LANGUAGE]; /* Music on Hold class */
+ char musicclass[MAX_MUSICCLASS]; /* Music on Hold class */
char rdnis[256]; /* Referring DNIS */
char theirtag[256]; /* Their tag */
char username[256]; /* [user] name */
@@ -604,7 +604,7 @@ struct sip_user {
char cid_name[80]; /* Caller ID name */
char accountcode[AST_MAX_ACCOUNT_CODE]; /* Account code */
char language[MAX_LANGUAGE]; /* Default language for this user */
- char musicclass[MAX_LANGUAGE]; /* Music on Hold class */
+ char musicclass[MAX_MUSICCLASS];/* Music on Hold class */
char useragent[256]; /* User agent in SIP request */
struct ast_codec_pref prefs; /* codec prefs */
ast_group_t callgroup; /* Call group */
@@ -648,7 +648,7 @@ struct sip_peer {
int outgoinglimit; /* disabled */
char mailbox[AST_MAX_EXTENSION]; /* Mailbox setting for MWI checks */
char language[MAX_LANGUAGE]; /* Default language for prompts */
- char musicclass[MAX_LANGUAGE]; /* Music on Hold class */
+ char musicclass[MAX_MUSICCLASS];/* Music on Hold class */
char useragent[256]; /* User agent in SIP request (saved from registration) */
struct ast_codec_pref prefs; /* codec prefs */
int lastmsgssent;
diff --git a/channels/chan_skinny.c b/channels/chan_skinny.c
index 7f96e8fcf..dd20e1bc2 100755
--- a/channels/chan_skinny.c
+++ b/channels/chan_skinny.c
@@ -674,7 +674,7 @@ static pthread_t tcp_thread;
static pthread_t accept_t;
static char context[AST_MAX_EXTENSION] = "default";
static char language[MAX_LANGUAGE] = "";
-static char musicclass[MAX_LANGUAGE] = "";
+static char musicclass[MAX_MUSICCLASS] = "";
static char cid_num[AST_MAX_EXTENSION] = "";
static char cid_name[AST_MAX_EXTENSION] = "";
static char linelabel[AST_MAX_EXTENSION] ="";
@@ -823,7 +823,7 @@ struct skinny_line {
char lastcallerid[AST_MAX_EXTENSION]; /* Last Caller*ID */
char call_forward[AST_MAX_EXTENSION];
char mailbox[AST_MAX_EXTENSION];
- char musicclass[MAX_LANGUAGE];
+ char musicclass[MAX_MUSICCLASS];
int curtone; /* Current tone being played */
ast_group_t callgroup;
ast_group_t pickupgroup;
diff --git a/channels/chan_zap.c b/channels/chan_zap.c
index 251eb5e33..f9c5c0f35 100755
--- a/channels/chan_zap.c
+++ b/channels/chan_zap.c
@@ -172,7 +172,7 @@ static char defaultcic[64] = "";
static char defaultozz[64] = "";
static char language[MAX_LANGUAGE] = "";
-static char musicclass[MAX_LANGUAGE] = "";
+static char musicclass[MAX_MUSICCLASS] = "";
static char progzone[10]= "";
static int usedistinctiveringdetection = 0;
@@ -566,7 +566,7 @@ static struct zt_pvt {
char defcontext[AST_MAX_EXTENSION];
char exten[AST_MAX_EXTENSION];
char language[MAX_LANGUAGE];
- char musicclass[MAX_LANGUAGE];
+ char musicclass[MAX_MUSICCLASS];
char cid_num[AST_MAX_EXTENSION];
int cid_ton; /* Type Of Number (TON) */
char cid_name[AST_MAX_EXTENSION];
diff --git a/include/asterisk/channel.h b/include/asterisk/channel.h
index 0ed9d00cc..817d3cc97 100755
--- a/include/asterisk/channel.h
+++ b/include/asterisk/channel.h
@@ -47,6 +47,7 @@ extern "C" {
#define MAX_LANGUAGE 20
+#define MAX_MUSICCLASS 20
#define AST_MAX_FDS 8
@@ -186,7 +187,7 @@ struct ast_channel {
int fds[AST_MAX_FDS];
/*! Default music class */
- char musicclass[MAX_LANGUAGE];
+ char musicclass[MAX_MUSICCLASS];
/*! Music State*/
void *music_state;
/*! Current generator data if there is any */
@@ -829,6 +830,14 @@ int ast_channel_bridge(struct ast_channel *c0,struct ast_channel *c1,struct ast_
channel is hung up. */
int ast_channel_masquerade(struct ast_channel *original, struct ast_channel *clone);
+/*! Gives the string form of a given cause code */
+/*!
+ * \param cause cause to get the description of
+ * Give a name to a cause code
+ * Returns the text form of the binary cause code given
+ */
+const char *ast_cause2str(int state);
+
/*! Gives the string form of a given channel state */
/*!
* \param state state to get the name of