· 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

ID
Password
Join
Promptness is its own reward, if one lives by the clock instead of the sword.


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.0078 sec