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
            ?

  • 相关阅读:
    【原】Sql2005 实现递归
    asp.net core api路由及多语言切换的实现
    一条语句实现查询各类别前10条记录
    【转】javascript操作cookies 以及 正确使用cookies的属性
    php 文件POST上传的原理及实现
    css3对background的调整与增强
    浅议javascript 中继承模式 (javascript高级程序设计)
    递归和递推:javascript求斐波那契数列的尾递归方法(转载)
    python中xrange和range的异同
    [译] JavaScript核心指南(JavaScript Core) 【转】
  • 原文地址:https://www.cnblogs.com/cutepig/p/4237804.html
Copyright © 2011-2022 走看看