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的基本结构主要包括以下几个核心部分: 类加载器&…...

24/11/14 算法笔记 GMM高斯混合模型
高斯混合模型(Gaussian Mixture Model,简称 GMM)是一种概率模型,用于表示具有多个子群体的数据集,其中每个子群体的数据分布可以用高斯分布(正态分布)来描述。GMM 是一种软聚类方法,…...

Linux下编译安装Nginx
以下是在Linux下编译安装Nginx的详细步骤: 一、安装依赖库 安装基本编译工具和库 在Debian/Ubuntu系统中,使用以下命令安装:sudo apt -y update sudo apt -y install build - essential libpcre3 - dev zlib1g - dev libssl - dev在CentOS/…...

算力100问☞第4问:算力的构成元素有哪些?
算力的构成元素是一个多维度且相互交织的体系,它融合了硬件基础设施、软件优化策略、数据处理效能以及分布式计算技术等多个层面,共同塑造了强大的计算能力。具体如下: 1、硬件基础设施 中央处理器(CPU):…...

安装paddle
网址:飞桨PaddlePaddle-源于产业实践的开源深度学习平台 或者找对应python和cuda版本的paddle下载后安装: https://www.paddlepaddle.org.cn/whl/linux/mkl/avx/stable.html 你想要安装paddlepaddle - gpu2.6.1.post112版本。在你提供的文件列表中&am…...

飞凌嵌入式RK3576核心板已适配Android 14系统
在今年3月举办的RKDC2024大会上,飞凌嵌入式FET3576-C核心板作为瑞芯微RK3576处理器的行业首秀方案重磅亮相,并于今年6月率先量产发货,为客户持续稳定地供应,得到了众多合作伙伴的认可。 FET3576-C核心板此前已提供了Linux 6.1.57…...

SpringBoot+MyBatis+MySQL的Point实现范围查找
前言 最近做了一个功能,需要通过用户当前位置点获取指定范围内的数据。由于后端存储用的是 MySQL,故选择使用 MySQL 中的 Point 实现范围查找功能。ORM 框架用的是 MyBatis,MyBatis 原生并不支持 Point 字段与 POJO 的映射,需要自…...

【Apache Paimon】-- 1 -- Apache Paimon 是什么?
目录 1、简介 2、概览 3、哪些场景可以使用 Paimon 4、周边生态 5、小结 6、参考 1、简介 我们听说过数据仓库、数据湖、数据湖仓,那你听说过流式数据仓库(Stream warehouse,简称:Streamhouse)吗?那我们今天就来解锁看看他们之中的新秀: Apache paimon 到底是什么…...

解决VsCode无法跳转问题
在settings.json中加入以下代码 { "files.associations": { "*.c":"c", "*.h":"c", "*.s":"masm" }, "includePath":[ "${workspaceFold…...

优化C++设计模式:用模板代替虚函数与多态机制
文章目录 0. 引言1. 模板编程替换虚函数和多态的必要性1.1. MISRA C对类型转换和虚函数的规定1.2. 虚函数与多态问题的影响及如何适应MISRA C要求1.3. 模板编程的优势:替代虚函数和多态机制 2. 设计模式改进2.1. 单例模式的改进与静态局部变量的对比(第二种实现) 2.…...

浪浪云轻量服务器搭建vulfocus网络安全靶场
什么是网络安全靶场 网络安全靶场是一个模拟真实网络环境的训练平台,旨在为网络安全专业人员提供一个安全的环境来测试和提高他们的技能。靶场通常包括各种网络设备、操作系统、应用程序和安全工具,允许用户在其中进行攻击和防御练习。以下是网络安全靶…...