OpenSIP2.4.11 向 FreeSWITCH 注册
应朋友要求做了个简单的测试,花费时间不过半小时,记录如下:
OpenSIPS IP 地址:192.168.31.213
FreeSWITCH IP 地址:192.168.31.166
加载 uac_registrant 模块(这个模块依赖 uac_auth 模块,得先加载),向 FreeSWITCH 注册
先插入数据:
INSERT INTO registrant (registrar, aor, username, password, expiry, binding_URI) VALUES ('sip:192.168.31.166', 'sip:1001@192.168.31.166', '1001', '1234', 3600, 'sip:1001@192.168.31.213');
启动 OpenSIPS
fs_cli -x 'show registrations as xml' 得到的是:
<result row_count="1">
<row row_id="1">
<reg_user>1001</reg_user>
<realm>192.168.31.166</realm>
<token>2a77c9767b233f5ccaa268ce13c</token>
<url>sofia/internal/sip:1001@192.168.31.213</url>
<expires>1731729381</expires>
<network_ip>192.168.31.213</network_ip>
<network_port>5060</network_port>
<network_proto>udp</network_proto>
<hostname>DESKTOP-QEPDSM1</hostname>
<metadata></metadata>
</row>
</result>
fs_cli -x 'sofia global siptrace on'
fs_cli -x 'chat sip|9999@192.168.31.166|1001@192.168.31.166|Hello,opensips'
send 621 bytes to udp/[192.168.31.213]:5060 at 03:00:02.046311:
------------------------------------------------------------------------
MESSAGE sip:1001@192.168.31.213 SIP/2.0
Via: SIP/2.0/UDP 120.229.53.37;rport;branch=z9hG4bKDr1cHXev367Hc
Max-Forwards: 70
From: "9999" <sip:9999@192.168.31.166>;tag=47HaZ55e0QZKc
To: "" <sip:1001@192.168.31.213>
Call-ID: 6abc3266-e8f8-4e8e-bfd4-ebbea2d3a45d
CSeq: 91309209 MESSAGE
User-Agent: FreeSWITCH-mod_sofia/1.10.12-dev-5976~218a00e2e9~64bit
Allow: INVITE, ACK, BYE, CANCEL, OPTIONS, MESSAGE, INFO, UPDATE, REGISTER, REFER, NOTIFY, PUBLISH, SUBSCRIBE
Supported: timer, path, replaces
Content-Type: text/html
Content-Length: 14
X-FS-Sending-Message: 645cecc3-2d65-4f0b-b536-a89fe9060d44
Hello,opensips
opensips.cfg 完整内容为(暂时没有响应 FS 的 MESSAGE 请求):
该文件是在 osipsconfig 产生的基础上做了少量修改而成
#
# OpenSIPS residential configuration script
# by OpenSIPS Solutions <team@opensips-solutions.com>
#
# This script was generated via "make menuconfig", from
# the "Residential" scenario.
# You can enable / disable more features / functionalities by
# re-generating the scenario with different options.#
#
# Please refer to the Core CookBook at:
# https://opensips.org/Resources/DocsCookbooks
# for a explanation of possible statements, functions and parameters.
######## Global Parameters #########log_level=3
log_stderror=no
log_facility=LOG_LOCAL0children=4/* uncomment the following lines to enable debugging */
#debug_mode=yes/* uncomment the next line to enable the auto temporary blacklisting ofnot available destinations (default disabled) */
#disable_dns_blacklist=no/* uncomment the next line to enable IPv6 lookup after IPv4 dnslookup failures (default disabled) */
#dns_try_ipv6=yes/* comment the next line to enable the auto discovery of local aliasesbased on reverse DNS on IPs */
auto_aliases=nolisten=udp:192.168.31.213:5060 # CUSTOMIZE ME
listen=tcp:192.168.31.213:5060 # CUSTOMIZE ME####### Modules Section #########set module path
mpath="/usr/local//lib64/opensips/modules/"#### SIGNALING module
loadmodule "signaling.so"#### StateLess module
loadmodule "sl.so"#### Transaction Module
loadmodule "tm.so"
modparam("tm", "fr_timeout", 5)
modparam("tm", "fr_inv_timeout", 30)
modparam("tm", "restart_fr_on_each_reply", 0)
modparam("tm", "onreply_avp_mode", 1)#### Record Route Module
loadmodule "rr.so"
/* do not append from tag to the RR (no need for this script) */
modparam("rr", "append_fromtag", 0)#### MAX ForWarD module
loadmodule "maxfwd.so"#### SIP MSG OPerationS module
loadmodule "sipmsgops.so"#### FIFO Management Interface
loadmodule "mi_fifo.so"
modparam("mi_fifo", "fifo_name", "/tmp/opensips_fifo")
modparam("mi_fifo", "fifo_mode", 0666)#### URI module
loadmodule "uri.so"
modparam("uri", "use_uri_table", 0)#### MYSQL module
loadmodule "db_mysql.so"#### HTTPD module
#loadmodule "httpd.so"
#modparam("httpd", "port", 8888)#### USeR LOCation module
loadmodule "usrloc.so"
modparam("usrloc", "nat_bflag", "NAT")
modparam("usrloc", "db_mode", 0)#### REGISTRAR module
loadmodule "registrar.so"
modparam("registrar", "tcp_persistent_flag", "TCP_PERSISTENT")
modparam("registrar", "received_avp", "$avp(received_nh)")/* uncomment the next line not to allow more than 10 contacts per AOR */
#modparam("registrar", "max_contacts", 10)#### ACCounting module
loadmodule "acc.so"
/* what special events should be accounted ? */
modparam("acc", "early_media", 0)
modparam("acc", "report_cancels", 0)
/* by default we do not adjust the direct of the sequential requests.if you enable this parameter, be sure the enable "append_fromtag"in "rr" module */
modparam("acc", "detect_direction", 0)#### AUTHentication modules
loadmodule "auth.so"
loadmodule "auth_db.so"
modparam("auth_db", "calculate_ha1", yes)
modparam("auth_db", "password_column", "password")
modparam("auth_db|uri", "db_url","mysql://opensips:opensipsrw@localhost/opensips") # CUSTOMIZE ME
modparam("auth_db", "load_credentials", "")#### NAT modules
loadmodule "nathelper.so"
modparam("nathelper", "natping_interval", 10)
modparam("nathelper", "ping_nated_only", 1)
modparam("nathelper", "sipping_bflag", "SIP_PING_FLAG")
modparam("nathelper", "sipping_from", "sip:pinger@127.0.0.1") #CUSTOMIZE ME
modparam("nathelper", "received_avp", "$avp(received_nh)")loadmodule "rtpproxy.so"
modparam("rtpproxy", "rtpproxy_sock", "udp:localhost:12221") # CUSTOMIZE MEloadmodule "uac_auth.so"loadmodule "uac_registrant.so"
modparam("uac_registrant", "timer_interval", 10)
modparam("uac_registrant", "db_url", "mysql://opensips:opensipsrw@localhost/opensips")#### MI_HTTP module
#loadmodule "mi_http.so"loadmodule "proto_udp.so"
loadmodule "proto_tcp.so"
####### Routing Logic ######### main request routing logicroute{# initial NAT handling; detect if the request comes from behind a NAT# and apply contact fixingforce_rport();if (nat_uac_test("23")) {if (is_method("REGISTER")) {fix_nated_register();setbflag(NAT);} else {fix_nated_contact();setflag(NAT);}}if (!mf_process_maxfwd_header("10")) {send_reply("483","Too Many Hops");exit;}if (has_totag()) {# handle hop-by-hop ACK (no routing required)if ( is_method("ACK") && t_check_trans() ) {t_relay();exit;}# sequential request within a dialog should# take the path determined by record-routingif ( !loose_route() ) {# we do record-routing for all our traffic, so we should not# receive any sequential requests without Route hdr.send_reply("404","Not here");exit;}if (is_method("BYE")) {# do accounting even if the transaction failsdo_accounting("log","failed");}if (check_route_param("nat=yes"))setflag(NAT);# route it out to whatever destination was set by loose_route()# in $du (destination URI).route(relay);exit;}# CANCEL processingif (is_method("CANCEL")) {if (t_check_trans())t_relay();exit;}# absorb retransmissions, but do not create transactiont_check_trans();if ( !(is_method("REGISTER") ) ) {if (is_myself("$fd")) {# authenticate if from local subscriber# authenticate all initial non-REGISTER request that pretend to be# generated by local subscriber (domain from FROM URI is local)if (!proxy_authorize("", "subscriber")) {proxy_challenge("", "0");exit;}if (!db_check_from()) {send_reply("403","Forbidden auth ID");exit;}consume_credentials();# caller authenticated} else {# if caller is not local, then called number must be localif (!is_myself("$rd")) {send_reply("403","Relay Forbidden");exit;}}}# preloaded route checkingif (loose_route()) {xlog("L_ERR","Attempt to route with preloaded Route's [$fu/$tu/$ru/$ci]");if (!is_method("ACK"))send_reply("403","Preload Route denied");exit;}# record routingif (!is_method("REGISTER|MESSAGE"))record_route();# account only INVITEsif (is_method("INVITE")) {do_accounting("log");}if (!is_myself("$rd")) {append_hf("P-hint: outbound\r\n");route(relay);}# requests for my domainif (is_method("PUBLISH|SUBSCRIBE")) {send_reply("503", "Service Unavailable");exit;}if (is_method("REGISTER")) {# authenticate the REGISTER requestsif (!www_authorize("", "subscriber")) {www_challenge("", "0");exit;}if (!db_check_to()) {send_reply("403","Forbidden auth ID");exit;}if ($proto == "tcp")setflag(TCP_PERSISTENT);if (isflagset(NAT)) {setbflag(SIP_PING_FLAG);}# store the registration and generate a SIP replyif (!save("location"))xlog("failed to register AoR $tu\n");exit;}if ($rU==NULL) {# request with no Username in RURIsend_reply("484","Address Incomplete");exit;}# do lookup with method filteringif (!lookup("location","m")) {if (!db_does_uri_exist()) {send_reply("420","Bad Extension");exit;}t_reply("404", "Not Found");exit;}if (isbflagset(NAT)) setflag(NAT);# when routing via usrloc, log the missed calls alsodo_accounting("log","missed");route(relay);
}route[relay] {# for INVITEs enable some additional helper routesif (is_method("INVITE")) {if (isflagset(NAT)) {rtpproxy_offer("ro");}t_on_branch("per_branch_ops");t_on_reply("handle_nat");t_on_failure("missed_call");}if (isflagset(NAT)) {add_rr_param(";nat=yes");}if (!t_relay()) {send_reply("500","Internal Error");}exit;
}branch_route[per_branch_ops] {xlog("new branch at $ru\n");
}onreply_route[handle_nat] {if (nat_uac_test("1"))fix_nated_contact();if ( isflagset(NAT) )rtpproxy_answer("ro");xlog("incoming reply\n");
}failure_route[missed_call] {if (t_was_cancelled()) {exit;}# uncomment the following lines if you want to block client# redirect based on 3xx replies.##if (t_check_status("3[0-9][0-9]")) {##t_reply("404","Not found");## exit;##}}
相关文章:
OpenSIP2.4.11 向 FreeSWITCH 注册
应朋友要求做了个简单的测试,花费时间不过半小时,记录如下: OpenSIPS IP 地址:192.168.31.213 FreeSWITCH IP 地址:192.168.31.166 加载 uac_registrant 模块(这个模块依赖 uac_auth 模块,得…...
【C++】深入理解 C++ 优先级队列、容器适配器与 deque:实现与应用解析
个人主页: 起名字真南的CSDN博客 个人专栏: 【数据结构初阶】 📘 基础数据结构【C语言】 💻 C语言编程技巧【C】 🚀 进阶C【OJ题解】 📝 题解精讲 目录 前言📌 1. 优先级队列、容器适配器和 deque 概述✨1.1 什么是优…...
Android 开发与救砖工具介绍
Android 开发与救砖工具介绍 在 Android 开发和设备维护中,fastboot、adb 和 9008 模式是三个非常重要的工具和模式。它们各自有不同的用途和操作方式,对于开发者和技术支持人员来说,了解它们的功能和使用方法是必不可少的。 1. Fastboot …...
vue2和vue3:diff算法的区别?
Vue 2 和 Vue 3 在 diff 算法方面的主要区别是: Vue 2 使用普通的 diff 算法,它会遍历所有的节点进行比对。 Vue 3 引入了 patch flag 的概念,并且对 diff 算法进行了优化,比如在相同层级的节点间不会去递归比对已经被移除的节点…...
后端返回大数问题
这个问题并不难,但是在开发的时候没有注意到 后端返回了一个列表数据,包含id,这个id是一个大数,列表进入详情,需要将id传入到详情页面详情页面内部通过id获取数据一直404,id不正确找问题,从路由传参到请求数据发现id没有问题,然后和后端进行联调,发现后端返回的id和我获取的id…...
vue3: ref, reactive, readonly, shallowReactive
vue3: ref, reactive, readonly, shallowReactive 原文地址:https://mp.weixin.qq.com/s/S3jPZKEMBP8nQQObF5d2VA <template><!-- <ul><li v-for"item in list.arr">{{item}}</li></ul><button click.prevent"add"…...
5G与4G互通的桥梁:N26接口
5G的商用部署进程将是一个基于4G系统进行的长期的替换、升级、迭代的过程,4G系统是在过渡到5G全覆盖过程中,作为保障用户业务连续性体验这一目的的最好补充。 因此4G/5G融合组网,以及互操作技术将是各大运营商在网络演进中需要重点考虑的问题…...
29-Elasticsearch 集群监控
Elasticsearch Stats 相关的 API ● Elasticsearch 提供了多个监控相关的 API ○ Node Stats: _nodes/stats ○ Cluster Stats: _cluster/stats ○ Index Stats: index_name/_stats Elasticsearch Task API ● 查看 Task 相关的 API ○ Pending Cluster Tasks…...
利用Excel批量生成含二维码的设备管理标签卡片
在日常办公中,批量制作标签是常见且繁琐的任务,尤其当这些标签需要包含大量数据并附带二维码以便快速扫描识别时,难度更是成倍增加。尽管传统的Word邮件合并功能在数据插入方面表现出色,但在二维码生成上却显得有些捉襟见肘。 为…...
小米运动健康与华为运动健康在苹手机ios系统中无法识别蓝牙状态 (如何在ios系统中开启 蓝牙 相册 定位 通知 相机等功能权限,保你有用)
小米运动健康与华为运动健康在苹手机ios系统中无法识别蓝牙状态 (解决方案在最下面,参考蓝牙权限设置方式举一反三开启其它模块的权限) 最近买了一台小米手表s4,但是苹手机ios系统中的 “小米运动健康” app 始终无法识别我手机…...
高亮变色显示文本中的关键字
效果 第一步:按如下所示代码创建一个用来高亮显示文本的工具类: public class KeywordUtil {/*** 单个关键字高亮变色* param color 变化的色值* param text 文字* param keyword 文字中的关键字* return*/public static SpannableString highLigh…...
Javascript垃圾回收机制-运行机制(大厂内部培训版本)
前言 计算机基本组成: 我们编写的软件首先读取到内存,用于提供给 CPU 进行运算处理。 内存的读取和释放,决定了程序性能。 冯诺依曼结构 解释和编译 这两个概念怎么理解呢。 编译相当于事先已经完成了可以直接用。好比去饭店吃饭点完上…...
【jvm】一个空Object对象的占多大空间
目录 1. 说明2. 结论 1. 说明 1.在Java中,一个空Object对象所占用的内存空间大小会受到JVM(Java虚拟机)实现和配置的影响,具体数值可能因不同JVM版本和配置而有所不同。2.但一般来说,可以基于一些通用的原则来估算这个…...
241114.学习日志——[CSDIY] [CS]数据结构与算法 [00]
CSDIY:这是一个非科班学生的努力之路,从今天开始这个系列会长期更新,(最好做到日更),我会慢慢把自己目前对CS的努力逐一上传,帮助那些和我一样有着梦想的玩家取得胜利!!&…...
The Planets: Earth -- 练习
环境搭建 该靶场环境来自Vulnhub -------- Difficulty: Easy 靶机与Kali的IP地址只需要在同一局域网即可(同一个网段,即两虚拟机处于同一网络模式),所以需要调整KALI和靶场的网络模式,为了方便测试本地采用NAT模式。 注意&…...
linux逻辑卷练习
目录 知识点: 常用命令 题目: 解题: 1)分区 2)创建物理卷 3)创建卷组 4)生成逻辑卷 "要带参数 -n" 5)扩容 6)格式化(添加文件系统) 7)挂…...
openai 论文Scaling Laws for Neural Language Models学习
2001.08361 (arxiv.org) 论文研究语言模型在交叉熵损失下的性能经验缩放定律:模型损失(性能)随模型大小、数据集大小和用于训练的计算量呈现缩放为幂律的关系,有些趋势跨越超过 7 个数量级。其他模型架构细节 (如网络…...
__VUE_PROD_HYDRATION_MISMATCH_DETAILS__ is not explicitly defined
VUE_PROD_HYDRATION_MISMATCH_DETAILS 未明确定义。您正在运行 Vue 的 esm-bundler 构建,它期望这些编译时功能标志通过捆绑器配置全局注入,以便在生产捆绑包中获得更好的tree-shaking优化。 Vue.js应用程序正在使用ESM(ECMAScript模块&#…...
基于PHP技术的校园站的设计与实现
毕业论文(基于PHP技术的校园站的设计与实现) 基于PHP技术的校园网站的设计与实现校园网作为教育、教学、科研、管理等工作的平台和基础设施,它的建立有助于加强师生之间的交流,改变传统的教学模式和教育管理方式,对促…...
JVM回收机制与算法
jvm基本结构 JVM(Java虚拟机)是Java程序可以跨平台运行的关键。它负责将Java字节码转换为特定平台的机器码,使Java程序能够在不同的硬件和操作系统上运行而无需重新编译。JVM的基本结构主要包括以下几个核心部分: 类加载器&…...
5个技巧快速掌握Happy Island Designer:免费在线岛屿设计工具终极指南
5个技巧快速掌握Happy Island Designer:免费在线岛屿设计工具终极指南 【免费下载链接】HappyIslandDesigner "Happy Island Designer (Alpha)",是一个在线工具,它允许用户设计和定制自己的岛屿。这个工具是受游戏《动物森友会》(A…...
如何在5分钟内掌握Illustrator智能填充神器Fillinger
如何在5分钟内掌握Illustrator智能填充神器Fillinger 【免费下载链接】illustrator-scripts Adobe Illustrator scripts 项目地址: https://gitcode.com/gh_mirrors/il/illustrator-scripts 还在为复杂的图案填充耗费数小时吗?今天我要为你介绍一款能彻底改变…...
彻底释放Mac磁盘空间:Pearcleaner如何智能清理应用残留文件
彻底释放Mac磁盘空间:Pearcleaner如何智能清理应用残留文件 【免费下载链接】Pearcleaner A free, source-available and fair-code licensed mac app cleaner 项目地址: https://gitcode.com/gh_mirrors/pe/Pearcleaner 你是否曾将应用拖入废纸篓后…...
【AI Agent软件直控革命】:20年架构师亲授5大落地陷阱与3步安全接入法
更多请点击: https://intelliparadigm.com 第一章:AI Agent软件直控革命:从概念到产业拐点 AI Agent 已不再停留于对话式助手或任务调度器的初级形态,正加速演进为具备环境感知、自主决策与系统级直控能力的“数字执行体”。其核…...
2025年Mac菜单栏革命:Ice如何重塑你的桌面工作流
2025年Mac菜单栏革命:Ice如何重塑你的桌面工作流 【免费下载链接】Ice Powerful menu bar manager for macOS 项目地址: https://gitcode.com/GitHub_Trending/ice/Ice 你是否曾因Mac菜单栏上的图标拥挤不堪而感到困扰?Wi-Fi、电池、时间等关键信…...
在线水印去除工具怎么选?2026年实测去水印方法+五大工具推荐
不管是做内容创作、整理素材,还是处理自己拍摄的视频和图片,水印问题都是绕不开的痛点。抖音、快手、小红书的视频里都带着平台水印,图片上有时也会被加上各种标记。那些网上找的素材更是五花八门的水印。怎么才能干净利落地去掉这些水印&…...
初创团队如何利用 Taotoken 以更低成本试用多种大模型
🚀 告别海外账号与网络限制!稳定直连全球优质大模型,限时半价接入中。 👉 点击领取海量免费额度 初创团队如何利用 Taotoken 以更低成本试用多种大模型 对于初创团队和独立开发者而言,在产品原型验证阶段,…...
2026实测:能耗管控场景下的AI工具数据分析能力横向对比,实在Agent如何通过ISSUT打破数据孤岛?
【摘要】 步入2026年,全球能源结构转型进入深水区。随着数据中心耗电量突破1000太瓦时(TWh)以及工业领域对“双碳”目标的刚性对标,能耗管控场景已成为企业运营的战略核心。然而,企业在推进自动化能效管理时࿰…...
保障企业级应用安全,如何利用 Taotoken 管理 API 密钥与审计日志
🚀 告别海外账号与网络限制!稳定直连全球优质大模型,限时半价接入中。 👉 点击领取海量免费额度 保障企业级应用安全,如何利用 Taotoken 管理 API 密钥与审计日志 在中大型企业的开发实践中,将大模型能力集…...
Python try...except ImportError 语句详解
在Python编程中,ImportError 是与模块导入相关的核心异常。优雅地处理它,是编写健壮、可维护和跨平台代码的关键。try...except ImportError 结构正是实现这一目标的标准工具。本文将为你抽丝剥茧,从基础概念到高级实践,全面解析这…...
