@ -41,6 +41,7 @@ ASTERISK_FILE_VERSION(__FILE__, "$Revision$")
# include "asterisk/channel.h"
# include "asterisk/channel.h"
# include "asterisk/cdr.h"
# include "asterisk/cdr.h"
# include "asterisk/callerid.h"
# include "asterisk/callerid.h"
# include "asterisk/manager.h"
# include "asterisk/causes.h"
# include "asterisk/causes.h"
# include "asterisk/linkedlists.h"
# include "asterisk/linkedlists.h"
# include "asterisk/utils.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 )
int ast_cdr_setaccount ( struct ast_channel * chan , const char * account )
{
{
struct ast_cdr * cdr = chan - > cdr ;
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 ) ;
ast_string_field_set ( chan , accountcode , account ) ;
for ( ; cdr ; cdr = cdr - > next ) {
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 ) ) ;
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 \n Uniqueid: %s \r \n AccountCode: %s \r \n OldAccountCode: %s \r \n " , chan - > name , chan - > uniqueid , chan - > accountcode , buf ) ;
return 0 ;
return 0 ;
}
}
@ -1408,6 +1415,7 @@ static int do_reload(int reload)
ast_mutex_unlock ( & cdr_batch_lock ) ;
ast_mutex_unlock ( & cdr_batch_lock ) ;
ast_config_destroy ( config ) ;
ast_config_destroy ( config ) ;
manager_event ( EVENT_FLAG_SYSTEM , " Reload " , " Module: CDR \r \n Message: CDR subsystem reload requested \r \n " ) ;
return res ;
return res ;
}
}