[asterisk-bugs] [JIRA] (ASTERISK-27798) CDR_PROP(party_a) does not work.

Kevin Harwell (JIRA) noreply at issues.asterisk.org
Thu Apr 12 17:10:50 CDT 2018


     [ https://issues.asterisk.org/jira/browse/ASTERISK-27798?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Kevin Harwell updated ASTERISK-27798:
-------------------------------------

    Reference Notes: 
main/cdr.c

/*!
 * \brief Given two CDR snapshots, figure out who should be Party A for the
 * resulting CDR
 * \param left One of the snapshots
 * \param right The other snapshot
 * \retval The snapshot that won
 */
static struct cdr_object_snapshot *cdr_object_pick_party_a(struct cdr_object_snapshot *left, struct cdr_object_snapshot *right)
{
        /* Check whether or not the party is dialed. A dialed party is never the
         * Party A with a party that was not dialed.
         */
        if (!snapshot_is_dialed(left->snapshot) && snapshot_is_dialed(right->snapshot)) {
                return left;
        } else if (snapshot_is_dialed(left->snapshot) && !snapshot_is_dialed(right->snapshot)) {
                return right;
        }

        /* Try the Party A flag */
        if (ast_test_flag(left, AST_CDR_FLAG_PARTY_A) && !ast_test_flag(right, AST_CDR_FLAG_PARTY_A)) {
                return left;
        } else if (!ast_test_flag(right, AST_CDR_FLAG_PARTY_A) && ast_test_flag(right, AST_CDR_FLAG_PARTY_A)) {
                return right;
        }

        /* Neither party is dialed and neither has the Party A flag - defer to
         * creation time */
        if (left->snapshot->creationtime.tv_sec < right->snapshot->creationtime.tv_sec) {
                return left;
        } else if (left->snapshot->creationtime.tv_sec > right->snapshot->creationtime.tv_sec) {
                return right;
        } else if (left->snapshot->creationtime.tv_usec > right->snapshot->creationtime.tv_usec) {
                return right;
        } else {
                /* Okay, fine, take the left one */
                return left;
        }
}


  was:
main/cdr.c
{noformat}
/*!
 * \brief Given two CDR snapshots, figure out who should be Party A for the
 * resulting CDR
 * \param left One of the snapshots
 * \param right The other snapshot
 * \retval The snapshot that won
 */
static struct cdr_object_snapshot *cdr_object_pick_party_a(struct cdr_object_snapshot *left, struct cdr_object_snapshot *right)
{
        /* Check whether or not the party is dialed. A dialed party is never the
         * Party A with a party that was not dialed.
         */
        if (!snapshot_is_dialed(left->snapshot) && snapshot_is_dialed(right->snapshot)) {
                return left;
        } else if (snapshot_is_dialed(left->snapshot) && !snapshot_is_dialed(right->snapshot)) {
                return right;
        }

        /* Try the Party A flag */
        if (ast_test_flag(left, AST_CDR_FLAG_PARTY_A) && !ast_test_flag(right, AST_CDR_FLAG_PARTY_A)) {
                return left;
        } else if (!ast_test_flag(right, AST_CDR_FLAG_PARTY_A) && ast_test_flag(right, AST_CDR_FLAG_PARTY_A)) {
                return right;
        }

        /* Neither party is dialed and neither has the Party A flag - defer to
         * creation time */
        if (left->snapshot->creationtime.tv_sec < right->snapshot->creationtime.tv_sec) {
                return left;
        } else if (left->snapshot->creationtime.tv_sec > right->snapshot->creationtime.tv_sec) {
                return right;
        } else if (left->snapshot->creationtime.tv_usec > right->snapshot->creationtime.tv_usec) {
                return right;
        } else {
                /* Okay, fine, take the left one */
                return left;
        }
}
{noformat}


> CDR_PROP(party_a) does not work.
> --------------------------------
>
>                 Key: ASTERISK-27798
>                 URL: https://issues.asterisk.org/jira/browse/ASTERISK-27798
>             Project: Asterisk
>          Issue Type: Bug
>      Security Level: None
>          Components: CDR/General
>    Affects Versions: 13.20.0
>            Reporter: Jeff Hoppe
>
> CDR_PROP(party_a) doesn't work.   I traced the code to main/cdr.c source file.  
> The function that determines which CDR is party A has two cdr snapshots as parameters.  The code is written where if the party_a flag was set on the second cdr snapshot (right), it will be ignored.
> Function showing in reference notes below.
>  This line (which will always be false):
>         } else if (!ast_test_flag(right, AST_CDR_FLAG_PARTY_A) && ast_test_flag(right, AST_CDR_FLAG_PARTY_A)) {
> .
> should be 
> .
>         } else if (!ast_test_flag(left, AST_CDR_FLAG_PARTY_A) && ast_test_flag(right, AST_CDR_FLAG_PARTY_A)) {
> if I am not mistaken.



--
This message was sent by Atlassian JIRA
(v6.2#6252)



More information about the asterisk-bugs mailing list