一、事件
switch_event.c文件中的函数负责事件的处理
EVENT_NODES结构保存了事件回调函数
函数switch_event_bind用来绑定回调函数
函数switch_event_deliver负责调用回调函数,把事件分发出去
二、sofia处理事件
在mod_sofia.c文件,以处理事件SWITCH_EVENT_SEND_MESSAGE为例
在初始化函数mod_sofia_load中,为事件绑定回调
switch_event_bind(modname, SWITCH_EVENT_SEND_MESSAGE, SWITCH_EVENT_SUBCLASS_ANY, general_queue_event_handler, NULL)
在general_queue_event_handler函数中,把事件放入sofia的队列general_event_queue中。
该队列会在sofia.c的线程函数sofia_profile_worker_thread_run中被取出,由函数general_event_handler来处理事件
网友评论