diff --git a/include/asterisk/cdr.h b/include/asterisk/cdr.h index 312c2546e983bd9729c397473d5d5ab0fd451e93..9cd65713a7a9f094140842987f2d5d23f267881c 100644 --- a/include/asterisk/cdr.h +++ b/include/asterisk/cdr.h @@ -284,6 +284,24 @@ void ast_cdr_setdestchan(struct ast_cdr *cdr, const char *chan); */ void ast_cdr_setapp(struct ast_cdr *cdr, const char *app, const char *data); +/*! + * \brief Set the answer time for a call + * \param cdr the cdr you wish to associate with the call + * \param t the answer time + * Starts all CDR stuff necessary for doing CDR when answering a call + * NULL argument is just fine. + */ +void ast_cdr_setanswer(struct ast_cdr *cdr, struct timeval t); + +/*! + * \brief Set the disposition for a call + * \param cdr the cdr you wish to associate with the call + * \param disposition the new disposition + * Set the disposition on a call. + * NULL argument is just fine. + */ +void ast_cdr_setdisposition(struct ast_cdr *cdr, long int disposition); + /*! * \brief Convert a string to a detail record AMA flag * \param flag string form of flag diff --git a/main/cdr.c b/main/cdr.c index 991b01a25ba77ef872f25e47258f6156a177a864..65c4e3e014fe13979fb6b8734ba93bcd48486c4e 100644 --- a/main/cdr.c +++ b/main/cdr.c @@ -787,6 +787,30 @@ void ast_cdr_setapp(struct ast_cdr *cdr, const char *app, const char *data) } } +void ast_cdr_setanswer(struct ast_cdr *cdr, struct timeval t) +{ + + for (; cdr; cdr = cdr->next) { + if (ast_test_flag(cdr, AST_CDR_FLAG_ANSLOCKED)) + continue; + if (ast_test_flag(cdr, AST_CDR_FLAG_DONT_TOUCH) && ast_test_flag(cdr, AST_CDR_FLAG_LOCKED)) + continue; + check_post(cdr); + cdr->answer = t; + } +} + +void ast_cdr_setdisposition(struct ast_cdr *cdr, long int disposition) +{ + + for (; cdr; cdr = cdr->next) { + if (ast_test_flag(cdr, AST_CDR_FLAG_LOCKED)) + continue; + check_post(cdr); + cdr->disposition = disposition; + } +} + /* set cid info for one record */ static void set_one_cid(struct ast_cdr *cdr, struct ast_channel *c) {