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;##}}

本文来自互联网用户投稿,该文观点仅代表作者本人,不代表本站立场。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如若转载,请注明出处:http://www.mzph.cn/web/59721.shtml

如若内容造成侵权/违法违规/事实不符,请联系多彩编程网进行投诉反馈email:809451989@qq.com,一经查实,立即删除!

相关文章

C/C++运行库

文章目录 入口函数glibc入口函数_start__libc_start_mainMSVC入口函数堆初始化IO初始化 glibc C运行库glibc启动文件gcc补充C全局构造与析构 运行库对于多线程的改进线程局部存储 入口函数 使用C语言编写的一个hello world程序在用户看来的确非常简单&#xff0c;源代码仅需要…

学习使用LVGL,依赖官方网址

LVGL Basics — LVGL documentation LVGL基础知识 LVGL是一个开源的图形库&#xff0c;提供创建嵌入式GUI的一切 LVGL数据流 您为每个物理显示面板 创建一个显示器 (lv_display) &#xff0c;在其上创建屏幕小部件&#xff0c;将小部件添加到这些屏幕上。要处理触摸、鼠标、…

计算机网络HTTP——针对实习面试

目录 计算机网络HTTP什么是HTTP&#xff1f;HTTP和HTTPS有什么区别&#xff1f;分别说明HTTP/1.0、HTTP/2.0、HTTP/3.0请说明访问网页的全过程请说明HTTP常见的状态码Cookie和Session有什么区别&#xff1f;HTTP请求方式有哪些&#xff1f;请解释GET和POST的区别&#xff1f;HT…

大数据-226 离线数仓 - Flume 优化配置 自定义拦截器 拦截原理 了 拦截器实现 Java

点一下关注吧&#xff01;&#xff01;&#xff01;非常感谢&#xff01;&#xff01;持续更新&#xff01;&#xff01;&#xff01; Java篇开始了&#xff01; 目前开始更新 MyBatis&#xff0c;一起深入浅出&#xff01; 目前已经更新到了&#xff1a; Hadoop&#xff0…

无人机动力系统测试-实测数据与CFD模拟仿真数据关联对比分析

我们经常被问到这样的问题&#xff1a;“我们计划运行 CFD 仿真&#xff0c;我们还需要对电机和螺旋桨进行实验测试吗&#xff1f;我们可能有偏见&#xff0c;但我们的答案始终是肯定的&#xff0c;而且有充分的理由。我们自己执行了大量的 CFD 仿真&#xff0c;但我们承认&…

验证双随机矩阵(doubly stochastic matrix) 满足C(P)=C(P^T)

验证双随机矩阵(doubly stochastic matrix) 满足C( P P P)C(P T ^T T) 双随机矩阵&#xff1a; 在数学中&#xff0c;一个双随机矩阵&#xff08;doubly stochastic matrix&#xff09;是一个满足以下条件的矩阵&#xff1a; 非负矩阵&#xff1a;矩阵中的每个元素都是非负的…

Chrome 浏览器开启打印模式

打开开发者工具ctrl shift p输入print 找到 Emulate CSS print media type

Vite初始化Vue3+Typescrpt项目

初始化项目 安装 Vite 首先&#xff0c;确保你的 Node.js 版本 > 12.0.0。然后在命令行中运行以下命令来创建一个 Vite Vue 3 TypeScript 的项目模板&#xff1a; npm init vitelatest进入项目目录 创建完成后&#xff0c;进入项目目录&#xff1a; cd vue3-demo启动…

24 年第十届数维杯国际数模竞赛赛题浅析

本次万众瞩目的数维杯国际大学生数学建模赛题已正式出炉&#xff0c;无论是赛题难度还是认可度&#xff0c;该比赛都是数模届的独一档&#xff0c;含金量极高&#xff0c;可以用于综测加分、保研、简历添彩等各方面。考虑到大家解题实属不易&#xff0c;为了帮助大家取得好成绩…

自动语音识别(ASR)与文本转语音(TTS)技术的应用与发展

&#x1f49d;&#x1f49d;&#x1f49d;欢迎来到我的博客&#xff0c;很高兴能够在这里和您见面&#xff01;希望您在这里可以感受到一份轻松愉快的氛围&#xff0c;不仅可以获得有趣的内容和知识&#xff0c;也可以畅所欲言、分享您的想法和见解。 推荐:kwan 的首页,持续学…

CentOS8 启动错误,enter emergency mode ,开机直接进入紧急救援模式,报错 Failed to mount /home 解决方法

先看现场问题截图&#xff1a; 1.根据提示 按 ctrld 输入 root 密码&#xff0c;进入系统。 2. 在紧急模式下运行&#xff1a;journalctl -xe &#xff0c;查看相关日志&#xff0c;找到关键点&#xff1a; Failed to mount /home 3.接着执行修复命令&#xff1a; xfs_repa…

Java项目实战II基于微信小程序的课堂助手(开发文档+数据库+源码)

目录 一、前言 二、技术介绍 三、系统实现 四、文档参考 五、核心代码 六、源码获取 全栈码农以及毕业设计实战开发&#xff0c;CSDN平台Java领域新星创作者&#xff0c;专注于大学生项目实战开发、讲解和毕业答疑辅导。获取源码联系方式请查看文末 一、前言 在数字化教…

借助 Pause 容器调试 Pod

借助 Pause 容器调试 Pod 在 K8S 中&#xff0c;Pod 是最核心、最基础的资源对象&#xff0c;也是 Kubernetes 中调度最小单元。在介绍 Pause 容器之前需要先说明下 Pod 与容器的关系来理解为什么需要 Pause 容器来帮助调试 1. Pod 与 容器的关系 Pod 是一个抽象的逻辑概念&…

IDEA自定义文件打开格式

介绍在IDEA中自定义文件打开格式的方法&#xff0c;比如一个文件&#xff0c;可以选择用txt格式打开&#xff0c;也可以选择用xml格式打开&#xff0c;也可以用java格式打开等等&#xff0c;通过这个方法可以方便的用任意格式在idea中打开想要打开的文件。 下面分别讨论三种不…

Git 分⽀规范 Git Flow 模型

前言 GitFlow 是一种流行的 Git 分支管理策略&#xff0c;由 Vincent Driessen 在 2010 年提出。它提供了一种结构化的方法来管理项目的开发、发布和维护&#xff0c;特别适合大型和复杂的项目。GitFlow 定义了一套明确的分支模型和工作流程&#xff0c;使得团队成员可以更有效…

ECG心电前级信号提取

由于ECG信号很微弱&#xff0c;处于mV级别&#xff0c;还有很多干扰信号&#xff0c;所以采集信号时需要进行滤波和放大处理&#xff0c;然后使用模数转换。为了滤波高频干扰和工频噪声&#xff0c;需要使用低通滤波器和陷波器抑制噪声&#xff0c;有时也要使用高通滤波器滤除低…

【Android】逆向开发与反逆向开发入门知识(一)

目录 逆向开发反编译 & 反混淆反编译工具反编译反混淆 修改预置资源文件抓包前期准备二次打包重签名 如何预防 App 被逆向开发&#xff1f;代码混淆应用加固防止动态调试Root 检测二次打包检测 警告&#xff1a;逆向开发相关知识请在法律规定范围内使用&#xff0c;请勿使用…

华为Mate 70临近上市:代理IP与抢购攻略

随着科技的飞速发展&#xff0c;智能手机已经成为我们日常生活中不可或缺的一部分。而在众多智能手机品牌中&#xff0c;华为一直以其卓越的技术和创新力引领着行业的发展。近日&#xff0c;华为Mate 70系列手机的发布会正式定档在11月26日&#xff0c;这一消息引发了众多科技爱…

【Linux之权限】理论篇

前言 Linux的权限是我们学习Linux初期非常重要的基础知识&#xff0c;接下来我将通过一个系列【Linux之权限】&#xff0c;共三篇文章&#xff0c;对此进行较为全面和详细的解说。 sudo 情况&#xff1a;如果我们不是超级管理员&#xff0c;但是想执行一个权限级别比较高的指…

[C++] 智能指针

文章目录 智能指针的使用原因及场景分析为什么需要智能指针&#xff1f;异常抛出导致的资源泄漏问题分析 智能指针与RAIIC常用智能指针 使用智能指针优化代码优化后的代码优化点分析 析构函数中的异常问题解决方法 RAII 和智能指针的设计思路详解什么是 RAII&#xff1f;RAII 的…