let hangup app optionally take a digit string for exact cause

git-svn-id: http://svn.freeswitch.org/svn/freeswitch/trunk@5497 d0543943-73ff-0310-b7d9-9358b9ac24b2
This commit is contained in:
Anthony Minessale 2007-07-03 21:05:41 +00:00
parent ea4835f111
commit c02f435a30
1 changed files with 7 additions and 3 deletions

View File

@ -139,11 +139,15 @@ SWITCH_DECLARE(switch_call_cause_t) switch_channel_str2cause(const char *str)
uint8_t x;
switch_call_cause_t cause = SWITCH_CAUSE_UNALLOCATED;
if (*str > 47 && *str < 58) {
cause = atoi(str);
} else {
for (x = 0; CAUSE_CHART[x].name; x++) {
if (!strcasecmp(CAUSE_CHART[x].name, str)) {
cause = CAUSE_CHART[x].cause;
}
}
}
return cause;
}