Yate SIP 代理路由配置
SIP 网关账号
[root@netkiller yate]# cp /usr/local/etc/yate/accfile.conf{,.backup}
[root@netkiller yate]# vim /usr/local/etc/yate/accfile.conf
[test_sip]
enabled=yes
protocol=sip
username=6002
description=Test SIP account
interval=600
authname=6002
password=6002
domain=sip.netkiller.cn
registrar=sip.netkiller.cn:5060
在 regexroute.conf 文件中加入拨号规则
^177$=line/177;line=test_sip
查看拨号时的日志
2025-04-13_10:41:53.727273 <INFO> Creating first 1 message dispatching threads
2025-04-13_10:41:53.949674 <sip:ALL> Set party trans_name=(null) proto=UDP local=:0 remote=sip.netkiller.cn:5060 [0x7f9a9c6fe690]
2025-04-13_10:41:53.950591 <sip:INFO> 'udp:0.0.0.0:5066' sending 462 bytes 'REGISTER sip:sip.netkiller.cn:5060' 0x7f9a80002ed0 to 139.9.54.211:5060 [0x1761e10]
-----
REGISTER sip:sip.netkiller.cn:5060 SIP/2.0
Contact: "Test SIP account" <sip:6002@192.168.0.230:5066>
Expires: 600
To: <sip:6002@sip.netkiller.cn>
Via: SIP/2.0/UDP 192.168.0.230:5066;rport;branch=z9hG4bK640589934
From: "Test SIP account" <sip:6002@sip.netkiller.cn>;tag=1024580135
Call-ID: 1863147204@sip.netkiller.cn
CSeq: 1 REGISTER
User-Agent: YATE/6.4.1
Max-Forwards: 70
Allow: ACK, INVITE, BYE, CANCEL, REGISTER, REFER, OPTIONS, INFO
Content-Length: 0
-----
2025-04-13_10:41:53.954645 <sip:INFO> 'udp:0.0.0.0:5066' received 488 bytes SIP message from 139.9.54.211:5060 [0x1761e10]
-----
SIP/2.0 401 Unauthorized
To: <sip:6002@sip.netkiller.cn>;tag=19db6516a6b774c682ff0634f6a75b73.c67d1b36
Via: SIP/2.0/UDP 192.168.0.230:5066;rport=5066;received=121.37.215.251;branch=z9hG4bK640589934
From: "Test SIP account" <sip:6002@sip.netkiller.cn>;tag=1024580135
Call-ID: 1863147204@sip.netkiller.cn
CSeq: 1 REGISTER
WWW-Authenticate: Digest realm="sip.netkiller.cn", nonce="Z/uWHWf7lPGFwDSFrH630CWoTEwIugwM", algorithm=MD5
Server: kamailio (6.0.1 (x86_64/linux))
Content-Length: 0
-----
2025-04-13_10:41:53.956454 <sip:INFO> 'udp:0.0.0.0:5066' sending 658 bytes 'REGISTER sip:sip.netkiller.cn:5060' 0x7f9a8c02fd80 to 139.9.54.211:5060 [0x1761e10]
-----
REGISTER sip:sip.netkiller.cn:5060 SIP/2.0
Contact: "Test SIP account" <sip:6002@192.168.0.230:5066>
Expires: 600
To: <sip:6002@sip.netkiller.cn>
Via: SIP/2.0/UDP 192.168.0.230:5066;rport;branch=z9hG4bK641722837
From: "Test SIP account" <sip:6002@sip.netkiller.cn>;tag=1024580135
Call-ID: 1863147204@sip.netkiller.cn
User-Agent: YATE/6.4.1
Max-Forwards: 70
Allow: ACK, INVITE, BYE, CANCEL, REGISTER, REFER, OPTIONS, INFO
CSeq: 2 REGISTER
Authorization: Digest username="6002", realm="sip.netkiller.cn", nonce="Z/uWHWf7lPGFwDSFrH630CWoTEwIugwM", uri="sip:sip.netkiller.cn:5060", response="71f8d782a165c3fa40dcf7801ddee299", algorithm=MD5
Content-Length: 0
-----
2025-04-13_10:41:53.963424 <sip:INFO> 'udp:0.0.0.0:5066' received 459 bytes SIP message from 139.9.54.211:5060 [0x1761e10]
-----
SIP/2.0 200 OK
To: <sip:6002@sip.netkiller.cn>;tag=19db6516a6b774c682ff0634f6a75b73.514a1b36
Via: SIP/2.0/UDP 192.168.0.230:5066;rport=5066;received=121.37.215.251;branch=z9hG4bK641722837
From: "Test SIP account" <sip:6002@sip.netkiller.cn>;tag=1024580135
Call-ID: 1863147204@sip.netkiller.cn
CSeq: 2 REGISTER
Contact: <sip:6002@192.168.0.230:5066>;expires=600;received="sip:121.37.215.251:5066"
Server: kamailio (6.0.1 (x86_64/linux))
Content-Length: 0
-----
2025-04-13_10:41:53.967334 <sip:INFO> Detected local address 121.37.215.251:5066 for SIP line 'test_sip'
2025-04-13_10:41:53.968079 <sip:CALL> SIP line 'test_sip' logon success to 139.9.54.211:5060
2025-04-13_10:41:56.003924 <sip:INFO> 'udp:0.0.0.0:5066' sending 464 bytes 'REGISTER sip:sip.netkiller.cn:5060' 0x7f9a80006780 to 139.9.54.211:5060 [0x1761e10]
-----
REGISTER sip:sip.netkiller.cn:5060 SIP/2.0
Contact: "Test SIP account" <sip:6002@121.37.215.251:5066>
Expires: 600
To: <sip:6002@sip.netkiller.cn>
Call-ID: 1863147204@sip.netkiller.cn
Via: SIP/2.0/UDP 121.37.215.251:5066;rport;branch=z9hG4bK712598825
From: "Test SIP account" <sip:6002@sip.netkiller.cn>;tag=1708696019
CSeq: 3 REGISTER
User-Agent: YATE/6.4.1
Max-Forwards: 70
Allow: ACK, INVITE, BYE, CANCEL, REGISTER, REFER, OPTIONS, INFO
Content-Length: 0
-----
2025-04-13_10:41:56.007306 <sip:INFO> 'udp:0.0.0.0:5066' received 489 bytes SIP message from 139.9.54.211:5060 [0x1761e10]
-----
SIP/2.0 401 Unauthorized
To: <sip:6002@sip.netkiller.cn>;tag=19db6516a6b774c682ff0634f6a75b73.ac65cb6c
Call-ID: 1863147204@sip.netkiller.cn
Via: SIP/2.0/UDP 121.37.215.251:5066;rport=5066;received=121.37.215.251;branch=z9hG4bK712598825
From: "Test SIP account" <sip:6002@sip.netkiller.cn>;tag=1708696019
CSeq: 3 REGISTER
WWW-Authenticate: Digest realm="sip.netkiller.cn", nonce="Z/uWIGf7lPSNcfm5ONYrypxF8zjHlh1S", algorithm=MD5
Server: kamailio (6.0.1 (x86_64/linux))
Content-Length: 0
-----
2025-04-13_10:41:56.009037 <sip:INFO> 'udp:0.0.0.0:5066' sending 661 bytes 'REGISTER sip:sip.netkiller.cn:5060' 0x7f9a8c0300e0 to 139.9.54.211:5060 [0x1761e10]
-----
REGISTER sip:sip.netkiller.cn:5060 SIP/2.0
Contact: "Test SIP account" <sip:6002@121.37.215.251:5066>
Expires: 600
To: <sip:6002@sip.netkiller.cn>
Call-ID: 1863147204@sip.netkiller.cn
Via: SIP/2.0/UDP 121.37.215.251:5066;rport;branch=z9hG4bK1464071456
From: "Test SIP account" <sip:6002@sip.netkiller.cn>;tag=1708696019
User-Agent: YATE/6.4.1
Max-Forwards: 70
Allow: ACK, INVITE, BYE, CANCEL, REGISTER, REFER, OPTIONS, INFO
CSeq: 4 REGISTER
Authorization: Digest username="6002", realm="sip.netkiller.cn", nonce="Z/uWIGf7lPSNcfm5ONYrypxF8zjHlh1S", uri="sip:sip.netkiller.cn:5060", response="0bd902738a75ca30a59875397828e064", algorithm=MD5
Content-Length: 0
-----
2025-04-13_10:41:56.014974 <sip:INFO> 'udp:0.0.0.0:5066' received 505 bytes SIP message from 139.9.54.211:5060 [0x1761e10]
-----
SIP/2.0 200 OK
To: <sip:6002@sip.netkiller.cn>;tag=19db6516a6b774c682ff0634f6a75b73.93ebcb6c
Call-ID: 1863147204@sip.netkiller.cn
Via: SIP/2.0/UDP 121.37.215.251:5066;rport=5066;received=121.37.215.251;branch=z9hG4bK1464071456
From: "Test SIP account" <sip:6002@sip.netkiller.cn>;tag=1708696019
CSeq: 4 REGISTER
Contact: <sip:6002@192.168.0.230:5066>;expires=597;received="sip:121.37.215.251:5066", <sip:6002@121.37.215.251:5066>;expires=600
Server: kamailio (6.0.1 (x86_64/linux))
Content-Length: 0
-----
2025-04-13_10:41:56.019182 <sip:CALL> SIP line 'test_sip' logon success to 139.9.54.211:5060
2025-04-13_10:42:22.004753 <sip:ALL> Sending UDP keepalive to 139.9.54.211:5060 for 'test_sip'
2025-04-13_10:42:48.000599 <sip:ALL> Sending UDP keepalive to 139.9.54.211:5060 for 'test_sip'
2025-04-13_10:43:14.002343 <sip:ALL> Sending UDP keepalive to 139.9.54.211:5060 for 'test_sip'
2025-04-13_10:43:40.000544 <sip:ALL> Sending UDP keepalive to 139.9.54.211:5060 for 'test_sip'
2025-04-13_10:44:06.000610 <sip:ALL> Sending UDP keepalive to 139.9.54.211:5060 for 'test_sip'