switch_channel: Add CS_NONE and correct variable name

This commit is contained in:
Marc Olivier Chouinard 2011-02-13 18:04:17 -05:00
parent a2c0da53f3
commit 3fd7b8f267

View File

@ -184,7 +184,7 @@ struct switch_callstate_table {
const char *name; const char *name;
switch_channel_callstate_t callstate; switch_channel_callstate_t callstate;
}; };
static struct switch_callstate_table STATE_CHART[] = { static struct switch_callstate_table CALLSTATE_CHART[] = {
{"DOWN", CCS_DOWN}, {"DOWN", CCS_DOWN},
{"DIALING", CCS_DIALING}, {"DIALING", CCS_DIALING},
{"RINGING", CCS_RINGING}, {"RINGING", CCS_RINGING},
@ -228,9 +228,9 @@ SWITCH_DECLARE(const char *) switch_channel_callstate2str(switch_channel_callsta
uint8_t x; uint8_t x;
const char *str = "UNKNOWN"; const char *str = "UNKNOWN";
for (x = 0; x < (sizeof(STATE_CHART) / sizeof(struct switch_cause_table)) - 1; x++) { for (x = 0; x < (sizeof(CALLSTATE_CHART) / sizeof(struct switch_cause_table)) - 1; x++) {
if (STATE_CHART[x].callstate == callstate) { if (CALLSTATE_CHART[x].callstate == callstate) {
str = STATE_CHART[x].name; str = CALLSTATE_CHART[x].name;
break; break;
} }
} }
@ -238,6 +238,7 @@ SWITCH_DECLARE(const char *) switch_channel_callstate2str(switch_channel_callsta
return str; return str;
} }
SWITCH_DECLARE(switch_call_cause_t) switch_channel_str2callstate(const char *str) SWITCH_DECLARE(switch_call_cause_t) switch_channel_str2callstate(const char *str)
{ {
uint8_t x; uint8_t x;
@ -246,9 +247,9 @@ SWITCH_DECLARE(switch_call_cause_t) switch_channel_str2callstate(const char *str
if (*str > 47 && *str < 58) { if (*str > 47 && *str < 58) {
callstate = atoi(str); callstate = atoi(str);
} else { } else {
for (x = 0; x < (sizeof(STATE_CHART) / sizeof(struct switch_callstate_table)) - 1 && STATE_CHART[x].name; x++) { for (x = 0; x < (sizeof(CALLSTATE_CHART) / sizeof(struct switch_callstate_table)) - 1 && CALLSTATE_CHART[x].name; x++) {
if (!strcasecmp(STATE_CHART[x].name, str)) { if (!strcasecmp(CALLSTATE_CHART[x].name, str)) {
callstate = STATE_CHART[x].callstate; callstate = CALLSTATE_CHART[x].callstate;
break; break;
} }
} }
@ -1606,6 +1607,7 @@ static const char *state_names[] = {
"CS_HANGUP", "CS_HANGUP",
"CS_REPORTING", "CS_REPORTING",
"CS_DESTROY", "CS_DESTROY",
"CS_NONE",
NULL NULL
}; };