· KLDP.org · KLDP.net · KLDP Wiki · KLDP BBS ·
Asterisk Ver0-2-0/Call Detail Record

AsteriskVer0-2-0/CallDetailRecord

* pbx.c
  • ast_cdr_start(c->cdr);
    • ast_pbx_run
      • pbx_thread
        • ast_pbx_start
          • ast_async_goto
            • ast_async_goto_by_name
          • ast_pbx_outgoing_exten
      • async_wait
        • ast_pbx_outgoing_exten

* ast_pbx_start
  • chan_alsa.c: alsa_new
  • chan_iax.c: ast_iax_new
  • chan_modem.c: ast_modem_new
  • chan_oss.c: oss_new
  • chan_phone.c: phone_new
  • chan_sip.c: sip_new
  • chan_vofr.c: vofr_new
  • chan_zap.c: zt_new

* ast_pbx_run
  • chan_zap.c: ss_thread, do_idle_thread

* manager.c
  • ast_pbx_outgoing_exten
    • action_originate

  • ast_async_goto_by_name
    • action_redirect
static struct action {
        char *action;
        int authority;
        int (*func)(struct mansession *s, struct message *m);
} actions[] = {
        { "Ping", 0, action_ping },
        { "Logoff", 0, action_logoff },
        { "Hangup", EVENT_FLAG_CALL, action_hangup },
        { "Status", EVENT_FLAG_CALL, action_status },
        { "Redirect", EVENT_FLAG_CALL, action_redirect },
        { "Originate", EVENT_FLAG_CALL, action_originate },
};

* process_message
  • session_do
    • accept_thread
      • init_manager
        • reload_manager

* loader.c
  • reload_manager
    • ast_module_reload

* asterisk.c
  • ast_module_reload
    • hup_handler

* cli.c
  • ast_module_reload
    • handle_reload
static struct ast_cli_entry builtins[] = {
...
{ { "reload", NULL }, handle_reload, "Reload configuration", reload_help },
...
        { { "unload", NULL }, handle_unload, "Unload a dynamic module by name", unload_help, complete_fn },
        { { NULL }, NULL, NULL, NULL }
};

CDR flow

* pbx.c
  • int ast_pbx_run(struct ast_channel *c)
    • if (c->amaflags) {
      • if (c->cdr) {
      • } else {
        • c->cdr = ast_cdr_alloc();
        • ast_cdr_init(c->cdr, c);
      • }
    • }
    • if (c->cdr)
      • ast_cdr_start(c->cdr);

  • int pbx_exec(struct ast_channel *c, struct ast_app *app, void *data, int newstack)
    • if (newstack && (res = setjmp(c->jmp++c->stack))) {
    • } else {
      • if (c->cdr)
        • ast_cdr_setapp(c->cdr, app->name, data);
    • }

* channel.c
  • int ast_hangup(struct ast_channel *chan)
    • if (chan->cdr) {
      • ast_cdr_end(chan->cdr);
      • ast_cdr_post(chan->cdr);
      • ast_cdr_free(chan->cdr);
    • }

  • int ast_answer(struct ast_channel *chan)
    • switch(chan->_state) {
    • case AST_STATE_RING:
      • if (chan->cdr)
        • ast_cdr_answer(chan->cdr);
    • }

  • struct ast_frame *ast_read(struct ast_channel *chan)
    • if (!f) {
      • if (chan->cdr)
        • ast_cdr_end(chan->cdr);
    • } else if (chan->deferdtmf && f->frametype == AST_FRAME_DTMF) {
    • } else if ((f->frametype == AST_FRAME_CONTROL) && (f->subclass == AST_CONTROL_ANSWER)) {
      • ast_cdr_answer(chan->cdr);
    • }

* app_dial.c
  • static struct ast_channel *wait_for_answer(struct ast_channel *in, struct localuser *outgoing, int *to, int *allowredir, int *allowdisconnect)
    • ast_cdr_busy(in->cdr);

  • static int dial_exec(struct ast_channel *chan, void *data)
    • ast_cdr_busy(chan->cdr);
    • ast_cdr_setdestchan(chan->cdr, peer->name);

* app_queue.c
  • static struct ast_channel *wait_for_answer(struct ast_channel *in, struct localuser *outgoing, int *to, int *allowredir, int *allowdisconnect, char *queue)
    • ast_cdr_busy(in->cdr);

  • static int try_calling(struct queue_ent *qe, char *options)
    • ast_cdr_busy(qe->chan->cdr);
    • ast_cdr_setdestchan(qe->chan->cdr, peer->name);

* chan_iax.c
  • int set_config(char *config_file, struct sockaddr_in* sin)
    • format = ast_cdr_amaflags2int(v->value);

  • static struct iax_user *build_user(char *name, struct ast_variable *v)
    • format = ast_cdr_amaflags2int(v->value);

* chan_sip.c
  • static struct sip_user *build_user(char *name, struct ast_variable *v)
    • format = ast_cdr_amaflags2int(v->value);

* chan_zap.c
  • static struct ast_channel *zt_request(char *type, int format, void *data)
    • tmp->cdrflags |= AST_CDR_CALLWAIT;

  • int load_module()
    • y = ast_cdr_amaflags2int(v->value);

cdr function


* ast_cdr_alloc
  • alloc cdr

* ast_cdr_free

* ast_cdr_init
  • channel 에서 필요한 사항을 cdr 로 복사.
  • channel 의 상태에 따라 cdr disposition 설정

* ast_cdr_start
  • cdr->start 를 현재시간으로 설정

* ast_cdr_end

* ast_cdr_setapp
  • cdr->lastapp 와 cdr->lastdata 설정
  • pbx_exec 에서 이후 application 을 수행함.
  • call 에 대해 최종으로 수행된 application 을 아르켜 줌.

* ast_cdr_answer
  • cdr->disposition 을 AST_CDR_ANSWERED 로 설정하고
  • cdr->answer 에 현재 시간을 설정.

* ast_cdr_busy
  • cdr->disposition 을 AST_CDR_BUSY 로 설정

* ast_cdr_post
  • cdr->duration 과 cdr->billsec 을 설정하고, i->be(cdr) 을 사용하여 cdr 저장
  • duration 은 start 에서 end 이고 billsec 는 answer 에서 end 까지 임.

* ast_cdr_setdestchan
  • cdr->dstchannel 을 설정

* ast_cdr_amaflags2int

* ast_cdr_disp2str

* ast_cdr_flags2str

* ast_cdr_setaccount



* ast_cdr_end

* ast_cdr_register

* ast_cdr_unregister



sponsored by andamiro
sponsored by cdnetworks
sponsored by HP

Valid XHTML 1.0! Valid CSS! powered by MoniWiki
last modified 2009-10-07 05:09:09
Processing time 0.0100 sec