0
if (method=="INVITE" && uri=~"NUMBER")
   {
       #rewriteuri("sip:+45NUMBER@voipXXX.opensips.local");
       rewritehost("voipXXX.opensips.local");
       t_relay();
       exit;

这是我的 openSIPS 服务器如何处理邀请的一个示例,我想这样做,以便我只能接受来自某些 ips 的邀请?有谁知道如何做到这一点。

这仅考虑正在呼叫的号码,而不是来自哪个 IP

4

2 回答 2

0

&& $si == '10.0.0.1'

http://www.opensips.org/Documentation/Script-CoreVar

第 3.79 节

于 2014-09-12T09:25:39.423 回答
0

Instead of hardcoding the source IPs you want to allow, take a look at the PERMISSIONS module.

http://www.opensips.org/html/docs/modules/1.11.x/permissions.html

Especially take a look at the check_source_address command.

You may create a group and put inside all the authorized IPs. For example, if you created group 1, you can use this snippet in your script:

if(!check_source_address("1")) {
    send_reply("403","Forbidden");
    exit;
} 
于 2014-09-16T09:00:10.343 回答