首先打开一个简单的呼叫 - 从SIP客户端接收呼叫,然后将其发送到SIP Server-

问题描述 投票:0回答:1
我已经安装了新鲜的opensips,可以说它在192.168.10.50,

我想要的是从IP 1.1.1.1接收来自SIP客户端的呼叫,然后将其发送到SIPServer10.10.10.50

我正在接收opensip上的呼叫,并使用简单的t_relay将呼叫发送到服务器,但是OpenSip在请求URI主机中发送了相同的IP 例如,它应以

[电子邮件保护]

但是它将呼叫发送给服务器,以[电子邮件保护] IP“ 192.168.10.50”属于自身,它不应该这样做,而是这样做。 贝洛(Below)是路由cf的摘录。

Socket= UDP:192.168.10.50:5060

用于处理来电的路由

route {

if (is_method("INVITE")) { # Modify the request URI if necessary # Log the modified request URI for debugging xlog("Modified Request URI: $ru\n"); # Relay the call to the destination SIP server if (!send("10.10.10.50:5060")) { xlog("Failed to send call to destination server\n"); exit; } }

}
i我期望opensips通过修改后将呼叫发送到SIP服务器,因为我告诉他发送(“ 10.10.10.50:5060”)
但这不会改变

sip中,有时两个不同的概念有时会感到困惑:

voip opensips
1个回答
0
投票

SIPrequest -uri- SIP协议中的逻辑目的地

当您使用send(“ 10.10.10.50:5060”)时,您只会更改网络级目标(数据包的位置),而不是在消息标题中出现的SIP Request-uri。目标服务器可能期望request-uri匹配其自己的地址。 首先,我们使用$(ru {uri.user})

从原始request-uri中提取用户名部分

然后,我们使用目标服务器的地址构建了一个新的请求 - uri:$ ru =“ sip:” + $ var(username) +“@10.10.10.50:5060”

最终,我们使用t_relay()而不是send(),因为t_relay()是在OpenSIPS中基于事务转发的正确方法

socket=udp:192.168.10.50:5060 # Route for handling incoming calls route { if (is_method("INVITE")) { # Log the initial Request URI for debugging xlog("L_INFO", "Initial Request URI: $ru\n"); # Extract the username from the Request URI # This preserves the original dialed number/username $var(username) = $(ru{uri.user}); # Modify the Request URI to point to the destination server # This sets both the host and port in the Request URI $ru = "sip:" + $var(username) + "@10.10.10.50:5060"; # Log the modified Request URI for debugging xlog("L_INFO", "Modified Request URI: $ru\n"); # Relay the call to the destination # t_relay() uses the modified Request URI if (!t_relay()) { xlog("L_ERROR", "Failed to relay call to destination server\n"); sl_reply_error(); exit; } } }

最新问题
© www.soinside.com 2019 - 2025. All rights reserved.