mirror of
https://github.com/asterisk/asterisk.git
synced 2025-10-12 15:45:18 +00:00
New manager event when a channel changes account code.
Maybe belongs in the new cdr category? ---moremanager--- Event: NewAccountCode Modules: cdr.c Purpose: To report a change in account code for a live channel Example: Event: NewAccountCode Privilege: call,all Channel: SIP/olle-01844600 Uniqueid: 1177530895.2 AccountCode: Stinas account 1234848484 OldAccountCode: Olles Account 12345 git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@91408 65c4cc65-6c06-0410-ace0-fbb531ad65f3
This commit is contained in:
@@ -41,6 +41,7 @@ ASTERISK_FILE_VERSION(__FILE__, "$Revision$")
|
||||
#include "asterisk/channel.h"
|
||||
#include "asterisk/cdr.h"
|
||||
#include "asterisk/callerid.h"
|
||||
#include "asterisk/manager.h"
|
||||
#include "asterisk/causes.h"
|
||||
#include "asterisk/linkedlists.h"
|
||||
#include "asterisk/utils.h"
|
||||
@@ -892,6 +893,9 @@ char *ast_cdr_flags2str(int flag)
|
||||
int ast_cdr_setaccount(struct ast_channel *chan, const char *account)
|
||||
{
|
||||
struct ast_cdr *cdr = chan->cdr;
|
||||
char buf[BUFSIZ/2] = "";
|
||||
if (!ast_strlen_zero(chan->accountcode))
|
||||
ast_copy_string(buf, chan->accountcode, sizeof(buf));
|
||||
|
||||
ast_string_field_set(chan, accountcode, account);
|
||||
for ( ; cdr ; cdr = cdr->next) {
|
||||
@@ -899,6 +903,9 @@ int ast_cdr_setaccount(struct ast_channel *chan, const char *account)
|
||||
ast_copy_string(cdr->accountcode, chan->accountcode, sizeof(cdr->accountcode));
|
||||
}
|
||||
}
|
||||
|
||||
/* Signal change of account code to manager */
|
||||
manager_event(EVENT_FLAG_CALL, "NewAccountCode", "Channel: %s\r\nUniqueid: %s\r\nAccountCode: %s\r\nOldAccountCode: %s\r\n", chan->name, chan->uniqueid, chan->accountcode, buf);
|
||||
return 0;
|
||||
}
|
||||
|
||||
@@ -1408,6 +1415,7 @@ static int do_reload(int reload)
|
||||
|
||||
ast_mutex_unlock(&cdr_batch_lock);
|
||||
ast_config_destroy(config);
|
||||
manager_event(EVENT_FLAG_SYSTEM, "Reload", "Module: CDR\r\nMessage: CDR subsystem reload requested\r\n");
|
||||
|
||||
return res;
|
||||
}
|
||||
|
Reference in New Issue
Block a user