You need to enable JavaScript to run this app.
优惠活动
大模型
产品
解决方案
定价
更多

配置OpenSIPS模块对接PostgreSQL及解决启动函数缺失报错

OpenSIPS对接PostgreSQL配置报错:b2b_entities模块无法找到数据库接口函数

问题详情

找不到B2B、dialog等模块对接PostgreSQL的配置资料,当前b2b_entities模块的配置如下:

loadmodule "db_postgres.so"
modparam("b2b_entities", "db_url", "postgresql://postgres@spark_pgsql:5432")

启动OpenSIPS时,日志中出现一系列数据库接口函数未找到的错误:

"level": "ERROR", "module": "core", "function": "db_check_api", "message": "module db_postgresql does not export db_use_table function\n"
"level": "DBG", "module": "core", "function": "find_mod_export", "message": "<db_bind_api> in module db_postgresql not found\n"
"level": "DBG", "module": "core", "function": "db_bind_mod", "message": "using export interface to bind db_postgresql\n"
"level": "DBG", "module": "core", "function": "find_mod_export", "message": "<db_use_table> in module db_postgresql not found\n"
"level": "DBG", "module": "core", "function": "find_mod_export", "message": "<db_init> in module db_postgresql not found\n"
"level": "DBG", "module": "core", "function": "find_mod_export", "message": "<db_close> in module db_postgresql not found\n"
"level": "DBG", "module": "core", "function": "find_mod_export", "message": "<db_query> in module db_postgresql not found\n"
"level": "DBG", "module": "core", "function": "find_mod_export", "message": "<db_fetch_result> in module db_postgresql not found\n"
"level": "DBG", "module": "core", "function": "find_mod_export", "message": "<db_raw_query> in module db_postgresql not found\n"
"level": "DBG", "module": "core", "function": "find_mod_export", "message": "<db_free_result> in module db_postgresql not found\n"
"level": "DBG", "module": "core", "function": "find_mod_export", "message": "<db_insert> in module db_postgresql not found\n"
"level": "DBG", "module": "core", "function": "find_mod_export", "message": "<db_delete> in module db_postgresql not found\n"
"level": "DBG", "module": "core", "function": "find_mod_export", "message": "<db_update> in module db_postgresql not found\n"
"level": "DBG", "module": "core", "function": "find_mod_export", "message": "<db_replace> in module db_postgresql not found\n"
"level": "DBG", "module": "core", "function": "find_mod_export", "message": "<db_last_inserted_id> in module db_postgresql not found\n"
"level": "DBG", "module": "core", "function": "find_mod_export", "message": "<db_insert_update> in module db_postgresql not found\n"

解决方案

  • 修正模块名称匹配问题:错误日志中提到的db_postgresql是名称错误,实际加载的模块是db_postgres.so,正确模块名为db_postgres(无末尾的ql)。需确保配置中模块名一致,同时b2b_entities的数据库连接需通过db_postgres模块生效,正确配置示例:
    loadmodule "db_postgres.so"
    modparam("db_postgres", "db_url", "postgresql://postgres@spark_pgsql:5432/opensips_db")
    modparam("b2b_entities", "db_url", "postgresql://postgres@spark_pgsql:5432/opensips_db")
    
  • 确认模块编译与加载状态:执行opensips -l命令查看已加载模块列表,确认db_postgres是否存在。如果未加载,说明编译OpenSIPS时未启用PostgreSQL模块,需重新编译并添加--enable-db-postgres参数,确保模块正确编译安装。
  • 完善数据库连接URL:原URL缺少目标数据库名称,需补充提前在PostgreSQL中创建的OpenSIPS专用数据库名;若用户设置了密码,也要加入URL:
    postgresql://postgres:your_password@spark_pgsql:5432/opensips_db
    
  • 验证PostgreSQL服务连通性:检查spark_pgsql主机的PostgreSQL服务是否正常运行,端口5432是否开放,postgres用户是否拥有目标数据库的连接权限。

内容的提问来源于stack exchange,提问作者WitHeld

相关产品推荐
方舟 Agent Plan

超全模态模型 × Harness 升级,最新支持 Deepseek-V4.1-Flash、GLM-5.3 系列、Doubao-Seedream-5.0-pro、Kimi-K3 (部分), 限时 9.9 元起

最近更新时间:2026.06.21 04:07:07