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的基本结构主要包括以下几个核心部分: 类加载器&…...
SkyWalking 10.2.0 SWCK 配置过程
SkyWalking 10.2.0 & SWCK 配置过程 skywalking oap-server & ui 使用Docker安装在K8S集群以外,K8S集群中的微服务使用initContainer按命名空间将skywalking-java-agent注入到业务容器中。 SWCK有整套的解决方案,全安装在K8S群集中。 具体可参…...
调用支付宝接口响应40004 SYSTEM_ERROR问题排查
在对接支付宝API的时候,遇到了一些问题,记录一下排查过程。 Body:{"datadigital_fincloud_generalsaas_face_certify_initialize_response":{"msg":"Business Failed","code":"40004","sub_msg…...
51c自动驾驶~合集58
我自己的原文哦~ https://blog.51cto.com/whaosoft/13967107 #CCA-Attention 全局池化局部保留,CCA-Attention为LLM长文本建模带来突破性进展 琶洲实验室、华南理工大学联合推出关键上下文感知注意力机制(CCA-Attention),…...
【Redis技术进阶之路】「原理分析系列开篇」分析客户端和服务端网络诵信交互实现(服务端执行命令请求的过程 - 初始化服务器)
服务端执行命令请求的过程 【专栏简介】【技术大纲】【专栏目标】【目标人群】1. Redis爱好者与社区成员2. 后端开发和系统架构师3. 计算机专业的本科生及研究生 初始化服务器1. 初始化服务器状态结构初始化RedisServer变量 2. 加载相关系统配置和用户配置参数定制化配置参数案…...
Opencv中的addweighted函数
一.addweighted函数作用 addweighted()是OpenCV库中用于图像处理的函数,主要功能是将两个输入图像(尺寸和类型相同)按照指定的权重进行加权叠加(图像融合),并添加一个标量值&#x…...
汽车生产虚拟实训中的技能提升与生产优化
在制造业蓬勃发展的大背景下,虚拟教学实训宛如一颗璀璨的新星,正发挥着不可或缺且日益凸显的关键作用,源源不断地为企业的稳健前行与创新发展注入磅礴强大的动力。就以汽车制造企业这一极具代表性的行业主体为例,汽车生产线上各类…...
如何将联系人从 iPhone 转移到 Android
从 iPhone 换到 Android 手机时,你可能需要保留重要的数据,例如通讯录。好在,将通讯录从 iPhone 转移到 Android 手机非常简单,你可以从本文中学习 6 种可靠的方法,确保随时保持连接,不错过任何信息。 第 1…...
vue3+vite项目中使用.env文件环境变量方法
vue3vite项目中使用.env文件环境变量方法 .env文件作用命名规则常用的配置项示例使用方法注意事项在vite.config.js文件中读取环境变量方法 .env文件作用 .env 文件用于定义环境变量,这些变量可以在项目中通过 import.meta.env 进行访问。Vite 会自动加载这些环境变…...
SQL慢可能是触发了ring buffer
简介 最近在进行 postgresql 性能排查的时候,发现 PG 在某一个时间并行执行的 SQL 变得特别慢。最后通过监控监观察到并行发起得时间 buffers_alloc 就急速上升,且低水位伴随在整个慢 SQL,一直是 buferIO 的等待事件,此时也没有其他会话的争抢。SQL 虽然不是高效 SQL ,但…...
【SSH疑难排查】轻松解决新版OpenSSH连接旧服务器的“no matching...“系列算法协商失败问题
【SSH疑难排查】轻松解决新版OpenSSH连接旧服务器的"no matching..."系列算法协商失败问题 摘要: 近期,在使用较新版本的OpenSSH客户端连接老旧SSH服务器时,会遇到 "no matching key exchange method found", "n…...
