zoukankan      html  css  js  c++  java
  • asterisk channel driver dev ref

    入口函数load_module
        load_config
        ast_channel_register console_tech
        ast_cli_register_multiple
        
    console_tech需要提供一系列的毁掉函数,比如    
        static struct ast_channel_tech console_tech = {
        .type = "Console",
        .description = "Console Channel Driver",
        .requester = console_request,
        .send_digit_begin = console_digit_begin,
        .send_digit_end = console_digit_end,
        .send_text = console_text,
        .hangup = console_hangup,
        .answer = console_answer,
        .read = console_read,
        .call = console_call,
        .write = console_write,
        .indicate = console_indicate,
        .fixup = console_fixup,
        };

    answer一般会启动monitor thread

    sample: chan_console.c

    http://svn.asterisk.org/svn/asterisk/trunk/channels/chan_oss.c

    https://code.google.com/p/asterisk-chan-dongle/

    讨论

    http://lists.digium.com/pipermail/asterisk-dev/2008-January/031719.html

    load_module
        ast_calloc gpublic
        pdiscovery_init
            cache_init
                AST_RWLIST_HEAD_INIT
        public_state_init
            reload_config
            discovery_restart
                ast_pthread_create_background( do_discovery )
                the thread loops all devices
                    看看要做啥就做啥,比如
                    打开设备opentty
                    start_monitor monitor_thread do_monitor_phone
                        该线程监视data_fd和audio_fd
                            port_status
                                tcgetattr
                            at_wait
                            at_read
                            PVT_STAT
                            at_read_result_iov
                            at_read_result_classification
                            at_response
                    移除设备AST_RWLIST_REMOVE_CURRENT, pvt_free
            ast_channel_register(&channel_tech)
            cli_register
            app_register
            manager_register
            discovery_stop
            devices_destroy
        
    public_state
        devices
            a list
            AST_RWLIST_HEAD_INIT
            AST_RWLIST_RDLOCK
            AST_RWLIST_TRAVERSE
        discovery_lock
            a mutex
            ast_mutex_init
            ast_mutex_lock
            ast_mutex_destroy
        discovery_thread
            a thread
            ?

  • 相关阅读:
    Java实现 LeetCode 640 求解方程(计算器的加减法计算)
    PHP zip_entry_compressedsize() 函数
    PHP zip_entry_close() 函数
    PHP zip_close() 函数
    PHP xml_set_unparsed_entity_decl_handler() 函数
    PHP xml_set_processing_instruction_handler() 函数
    格列隙 | grid-row-gap (Grid Layout)
    格列隙 | grid-column-gap (Grid Layout)
    格列端 | grid-column-end (Grid Layout)
    格列开始 | grid-column-start (Grid Layout)
  • 原文地址:https://www.cnblogs.com/cutepig/p/4237804.html
Copyright © 2011-2022 走看看