mirror of
https://github.com/asterisk/asterisk.git
synced 2025-09-02 19:16:15 +00:00
CEL: Fix incorrect/missing extra field information
This corrects two issues with the extra field information in Asterisk 12+ in channel event logs. It is possible to inject custom values into the dialstatus provided by ast_channel_dial_type() Stasis messages that fall outside the enumeration allowed for the DIALSTATUS channel variable. CEL now filters for the allowed values and ignores other values. The "hangupsource" extra field key is always blank if the far end channel is a chan_pjsip channel. This is because the hangupsource is never set for the pjsip channel driver. This change sets the hangupsource whenever a hangup is queued for chan_pjsip channels. This corrects an issue with the pjsip channel driver where the hangupcause information was not being set properly. Review: https://reviewboard.asterisk.org/r/3690/ ........ Merged revisions 418071 from http://svn.asterisk.org/svn/asterisk/branches/12 git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@418084 65c4cc65-6c06-0410-ace0-fbb531ad65f3
This commit is contained in:
35
main/cel.c
35
main/cel.c
@@ -1270,6 +1270,35 @@ static void save_dialstatus(struct ast_multi_channel_blob *blob)
|
||||
}
|
||||
}
|
||||
|
||||
static int is_valid_dialstatus(struct ast_multi_channel_blob *blob)
|
||||
{
|
||||
const char *dialstatus = get_blob_variable(blob, "dialstatus");
|
||||
int res = 0;
|
||||
|
||||
if (ast_strlen_zero(dialstatus)) {
|
||||
res = 0;
|
||||
} else if (!strcasecmp(dialstatus, "CHANUNAVAIL")) {
|
||||
res = 1;
|
||||
} else if (!strcasecmp(dialstatus, "CONGESTION")) {
|
||||
res = 1;
|
||||
} else if (!strcasecmp(dialstatus, "NOANSWER")) {
|
||||
res = 1;
|
||||
} else if (!strcasecmp(dialstatus, "BUSY")) {
|
||||
res = 1;
|
||||
} else if (!strcasecmp(dialstatus, "ANSWER")) {
|
||||
res = 1;
|
||||
} else if (!strcasecmp(dialstatus, "CANCEL")) {
|
||||
res = 1;
|
||||
} else if (!strcasecmp(dialstatus, "DONTCALL")) {
|
||||
res = 1;
|
||||
} else if (!strcasecmp(dialstatus, "TORTURE")) {
|
||||
res = 1;
|
||||
} else if (!strcasecmp(dialstatus, "INVALIDARGS")) {
|
||||
res = 1;
|
||||
}
|
||||
return res;
|
||||
}
|
||||
|
||||
static void cel_dial_cb(void *data, struct stasis_subscription *sub,
|
||||
struct stasis_message *message)
|
||||
{
|
||||
@@ -1298,11 +1327,9 @@ static void cel_dial_cb(void *data, struct stasis_subscription *sub,
|
||||
}
|
||||
}
|
||||
|
||||
if (ast_strlen_zero(get_blob_variable(blob, "dialstatus"))) {
|
||||
return;
|
||||
if (is_valid_dialstatus(blob)) {
|
||||
save_dialstatus(blob);
|
||||
}
|
||||
|
||||
save_dialstatus(blob);
|
||||
}
|
||||
|
||||
static void cel_generic_cb(
|
||||
|
Reference in New Issue
Block a user