[FS][SOURCECODE][READ] One

博客介绍了FS相关的代码结构,包含main()函数、Module Database、mod_callcenter.c等内容,还涉及Add Agent和FS DEBUG。同时提供了windows10下安装source insight 4.0的链接,以及ODBC连接MySQL、PQsocket函数验证的参考链接。

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >

1 Structure

  • Source Code Download
# select version v1.8 download
https://freeswitch.org/stash/scm/fs/freeswitch.git

1.1 main()

  • main()
cd /src/switch.c
/* the main application entry point */
int main(int argc, char *argv[])
{
	/* attempt to initialize freeswitch and load modules */
	if (switch_core_init_and_modload(flags, nc ? SWITCH_FALSE : SWITCH_TRUE, &err) != SWITCH_STATUS_SUCCESS) 
	{
		fprintf(stderr, "Cannot Initialize [%s]\n", err);
		return 255;
	}
}
# 
# load modules depend on the conf-file which path is in /conf/autoload_configs/modules.conf

Module Database

mod_callcenter.c

Add Agent

FS DEBUG

在这里插入图片描述

  • FS DEBUG
mod_callcenter.c:903 Adding Agent 1013 with type callback with default status Logged Out
mod_callcenter.c:1211 Updated Agent 1013 set contact = [origination_caller_id_name=8088.call__time=120]  loopback / 8088
  • mod_callcenter.c
//callcenter_agent_add 
cc_status_t cc_agent_add(const char *agent, const char *type)
{
    cc_execute_sql(NULL, sql, NULL);
}


static switch_status_t cc_execute_sql(cc_queue_t *queue, char *sql, switch_mutex_t *mutex)
{
	switch_cache_db_handle_t *dbh = NULL;
	switch_status_t status = SWITCH_STATUS_FALSE;

	if (globals.global_database_lock) {
		if (mutex) {
			switch_mutex_lock(mutex);
		} else {
			switch_mutex_lock(globals.mutex);
		}
	}

	if (!(dbh = cc_get_db_handle())) {
		switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Error Opening DB\n");
		goto end;
	}

	status = switch_cache_db_execute_sql(dbh, sql, NULL);

end:

	switch_cache_db_release_db_handle(&dbh);

	if (globals.global_database_lock) {
		if (mutex) {
			switch_mutex_unlock(mutex);
		} else {
			switch_mutex_unlock(globals.mutex);
		}
	}

	return status;
}

Reference

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值