my
setup
request_route
{
if (!mf_process_maxfwd_header("10")) {
sl_send_reply("483","Too Many Hops");
exit;
}
if(is_method("OPTIONS")) {
# send reply for each options request
sl_send_reply("200", "ok");
exit();
}
if(method=="BYE") {
#Account BYE transactions
};
if
(method=="CANCEL") {
if
(t_check_trans()) t_relay();
exit;
};
if
(loose_route()) {
t_relay();
exit;
}
if
(is_method("INVITE")) {
record_route();
}
f
(!t_relay_to_udp("3.1.1.1", "5060")) {
sl_reply_error();
exit;
};
exit
};
here
is a trace to a call made to a hotel.
i
had changed the real ips for obvious reasons.
thanks.
asterisk
ip 1.1.1.1
kamailio
internal 1.1.1.2
kamailio
external 2.0.0.1
Voip
Carrier 3.1.1.1
voip
contact ip 3.1.1.2
Via:
SIP/2.0/UDP 1.1.1.1:5060;branch=z9hG4bK4bd52990;rport.
Max-Forwards:
70.
CSeq:
102 INVITE.
User-Agent:
Asterisk PBX 1.8.15-cert2.
Date:
Wed, 23 Oct 2013 21:26:46 GMT.
Allow:
INVITE, ACK, CANCEL, OPTIONS, BYE, REFER, SUBSCRIBE,
NOTIFY, INFO, PUBLISH.
Supported:
replaces, timer.
Privacy:
off.
Cisco-Guid:
25655507-3591552378-379709
Content-Type:
application/sdp.
Content-Length:
333.
.
v=0.
o=root
519803789 519803789 IN IP4 1.1.1.1.
s=Asterisk
PBX 1.8.15-cert2.
c=IN
IP4 1.1.1.1.
t=0
0.
m=audio
49926 RTP/AVP 0 18 3 8 101.
a=rtpmap:0
PCMU/8000.
a=rtpmap:18
G729/8000.
a=fmtp:18
annexb=no.
a=rtpmap:3
GSM/8000.
a=rtpmap:8
PCMA/8000.
a=rtpmap:101
telephone-event/8000.
a=fmtp:101
0-16.
a=ptime:20.
a=sendrecv.
SIP/2.0
100 trying -- your call is important to us.
Via:
SIP/2.0/UDP
1.1.1.1:5060;branch=z9hG4bK4bd52990;rport=5060.
CSeq:
102 INVITE.
Server:
kamailio (4.0.4 (x86_64/linux)).
Content-Length:
0.
.
Via:
SIP/2.0/UDP 2.0.0.1:5060;branch=z9hG4bK887c.94fdcd27.0.
Via:
SIP/2.0/UDP
1.1.1.1:5060;branch=z9hG4bK4bd52990;rport=5060.
Max-Forwards:
16.
CSeq:
102 INVITE.
User-Agent:
Asterisk PBX 1.8.15-cert2.
Date:
Wed, 23 Oct 2013 21:26:46 GMT.
Allow:
INVITE, ACK, CANCEL, OPTIONS, BYE, REFER, SUBSCRIBE,
NOTIFY, INFO, PUBLISH.
Supported:
replaces, timer.
Privacy:
off.
Cisco-Guid:
25655507-3591552378-379709
Content-Type:
application/sdp.
Content-Length:
333.
.
v=0.
o=root
519803789 519803789 IN IP4 1.1.1.1.
s=Asterisk
PBX 1.8.15-cert2.
c=IN
IP4 1.1.1.1.
t=0
0.
m=audio
49926 RTP/AVP 0 18 3 8 101.
a=rtpmap:0
PCMU/8000.
a=rtpmap:18
G729/8000.
a=fmtp:18
annexb=no.
a=rtpmap:3
GSM/8000.
a=rtpmap:8
PCMA/8000.
a=rtpmap:101
telephone-event/8000.
a=fmtp:101
0-16.
a=ptime:20.
a=sendrecv.
SIP/2.0
100 Giving a try.
Via:
SIP/2.0/UDP 2.0.0.1:5060;branch=z9hG4bK887c.94fdcd27.0.
Via:
SIP/2.0/UDP
1.1.1.1:5060;branch=z9hG4bK4bd52990;rport=5060.
CSeq:
102 INVITE.
Server:
gProxy (1.8.3 (i386/Linux)).
Content-Length:
0.
.
SIP/2.0
183 Session Progress.
Via:
SIP/2.0/UDP 2.0.0.1:5060;branch=z9hG4bK887c.94fdcd27.0.
Via:
SIP/2.0/UDP
1.1.1.1:5060;branch=z9hG4bK4bd52990;rport=5060.
CSeq:
102 INVITE.
Allow:
INVITE, BYE, OPTIONS, CANCEL, ACK, REGISTER, NOTIFY,
INFO, REFER, SUBSCRIBE, PRACK, UPDATE.
Call-Info:
<sip:3.1.1.2>;method="NOTIFY;Event=telephone-event;Duration=1000".
Allow-Events:
telephone-event.
Content-Type:
application/sdp.
Content-Length:
202.
.
v=0.
o=MSXB
4755 8544 IN IP4 3.1.1.2.
s=sip
call.
c=IN
IP4 204.15.40.111.
t=0
0.
m=audio
33408 RTP/AVP 0 101.
a=rtpmap:0
PCMU/8000.
a=rtpmap:101
telephone-event/8000.
a=fmtp:101
0-16.
a=ptime:20.
SIP/2.0
183 Session Progress.
Via:
SIP/2.0/UDP
1.1.1.1:5060;branch=z9hG4bK4bd52990;rport=5060.
CSeq:
102 INVITE.
Allow:
INVITE, BYE, OPTIONS, CANCEL, ACK, REGISTER, NOTIFY,
INFO, REFER, SUBSCRIBE, PRACK, UPDATE.
Call-Info:
<sip:3.1.1.2>;method="NOTIFY;Event=telephone-event;Duration=1000".
Allow-Events:
telephone-event.
Content-Type:
application/sdp.
Content-Length:
202.
.
v=0.
o=MSXB
4755 8544 IN IP4 3.1.1.2.
s=sip
call.
c=IN
IP4 204.15.40.111.
t=0
0.
m=audio
33408 RTP/AVP 0 101.
a=rtpmap:0
PCMU/8000.
a=rtpmap:101
telephone-event/8000.
a=fmtp:101
0-16.
a=ptime:20.
SIP/2.0
200 OK.
Session-Expires:
3600;refresher=uas.
Require:
timer.
Via:
SIP/2.0/UDP 2.0.0.1:5060;branch=z9hG4bK887c.94fdcd27.0.
Via:
SIP/2.0/UDP
1.1.1.1:5060;branch=z9hG4bK4bd52990;rport=5060.
CSeq:
102 INVITE.
Allow:
INVITE, BYE, OPTIONS, CANCEL, ACK, REGISTER, NOTIFY,
INFO, REFER, SUBSCRIBE, PRACK, UPDATE.
Call-Info:
<sip:3.1.1.2>;method="NOTIFY;Event=telephone-event;Duration=1000".
Allow-Events:
telephone-event.
Content-Type:
application/sdp.
Content-Length:
202.
.
v=0.
o=MSXB
4755 8544 IN IP4 3.1.1.2.
s=sip
call.
c=IN
IP4 204.15.40.111.
t=0
0.
m=audio
33408 RTP/AVP 0 101.
a=rtpmap:0
PCMU/8000.
a=rtpmap:101
telephone-event/8000.
a=fmtp:101
0-16.
a=ptime:20.
SIP/2.0
200 OK.
Session-Expires:
3600;refresher=uas.
Require:
timer.
Via:
SIP/2.0/UDP
1.1.1.1:5060;branch=z9hG4bK4bd52990;rport=5060.
CSeq:
102 INVITE.
Allow:
INVITE, BYE, OPTIONS, CANCEL, ACK, REGISTER, NOTIFY,
INFO, REFER, SUBSCRIBE, PRACK, UPDATE.
Call-Info:
<sip:3.1.1.2>;method="NOTIFY;Event=telephone-event;Duration=1000".
Allow-Events:
telephone-event.
Content-Type:
application/sdp.
Content-Length:
202.
.
v=0.
o=MSXB
4755 8544 IN IP4 3.1.1.2.
s=sip
call.
c=IN
IP4 204.15.40.111.
t=0
0.
m=audio
33408 RTP/AVP 0 101.
a=rtpmap:0
PCMU/8000.
a=rtpmap:101
telephone-event/8000.
a=fmtp:101
0-16.
a=ptime:20.
.....insert
into acc
(method,from_tag,to_tag,callid,sip_code,sip_reason,time,from_uri,to_uri,kekuintid,type_call,dst_ip,carriercode,callmode
) values ('INVITE','as4bc322e9','3591552407-393967','7d0ca48c1d48c14d104fac1f59194ae0@1.1.1.1:5060','200','OK','2013-10-23
17:26:16','sip:+19812457865@1.1.1.1','sip:23276341079@2.0.0.1','+19812457865','1.1.1.1','sip:76890723276341079@3.1.1.1:5060','sip:23276341079@2.0.0.1','OUT')
Via:
SIP/2.0/UDP 1.1.1.1:5060;branch=z9hG4bK05b1c5df;rport.
Max-Forwards:
70.
CSeq:
102 ACK.
User-Agent:
Asterisk PBX 1.8.15-cert2.
Content-Length:
0.
.
Via:
SIP/2.0/UDP 2.0.0.1:5060;branch=z9hG4bKcydzigwkX.
Via:
SIP/2.0/UDP
1.1.1.1:5060;branch=z9hG4bK05b1c5df;rport=5060.
Max-Forwards:
16.
CSeq:
102 ACK.
User-Agent:
Asterisk PBX 1.8.15-cert2.
Content-Length:
0.
.
SIP/2.0
200 OK.
Session-Expires:
3600;refresher=uas.
Require:
timer.
Via:
SIP/2.0/UDP 2.0.0.1:5060;branch=z9hG4bK887c.94fdcd27.0.
Via:
SIP/2.0/UDP
1.1.1.1:5060;branch=z9hG4bK4bd52990;rport=5060.
CSeq:
102 INVITE.
Allow:
INVITE, BYE, OPTIONS, CANCEL, ACK, REGISTER, NOTIFY,
INFO, REFER, SUBSCRIBE, PRACK, UPDATE.
Call-Info:
<sip:3.1.1.2>;method="NOTIFY;Event=telephone-event;Duration=1000".
Allow-Events:
telephone-event.
Content-Type:
application/sdp.
Content-Length:
202.
.
v=0.
o=MSXB
4755 8544 IN IP4 3.1.1.2.
s=sip
call.
c=IN
IP4 204.15.40.111.
t=0
0.
m=audio
33408 RTP/AVP 0 101.
a=rtpmap:0
PCMU/8000.
a=rtpmap:101
telephone-event/8000.
a=fmtp:101
0-16.
a=ptime:20.
SIP/2.0
200 OK.
Session-Expires:
3600;refresher=uas.
Require:
timer.
Via:
SIP/2.0/UDP
1.1.1.1:5060;branch=z9hG4bK4bd52990;rport=5060.
CSeq:
102 INVITE.
Allow:
INVITE, BYE, OPTIONS, CANCEL, ACK, REGISTER, NOTIFY,
INFO, REFER, SUBSCRIBE, PRACK, UPDATE.
Call-Info:
<sip:3.1.1.2>;method="NOTIFY;Event=telephone-event;Duration=1000".
Allow-Events:
telephone-event.
Content-Type:
application/sdp.
Content-Length:
202.
.
v=0.
o=MSXB
4755 8544 IN IP4 3.1.1.2.
s=sip
call.
c=IN
IP4 204.15.40.111.
t=0
0.
m=audio
33408 RTP/AVP 0 101.
a=rtpmap:0
PCMU/8000.
a=rtpmap:101
telephone-event/8000.
a=fmtp:101
0-16.
a=ptime:20.
Via:
SIP/2.0/UDP 1.1.1.1:5060;branch=z9hG4bK675a9141;rport.
Max-Forwards:
70.
CSeq:
102 ACK.
User-Agent:
Asterisk PBX 1.8.15-cert2.
Content-Length:
0.
.
Via:
SIP/2.0/UDP 2.0.0.1:5060;branch=z9hG4bKcydzigwkX.
Via:
SIP/2.0/UDP
1.1.1.1:5060;branch=z9hG4bK675a9141;rport=5060.
Max-Forwards:
16.
CSeq:
102 ACK.
User-Agent:
Asterisk PBX 1.8.15-cert2.
Content-Length:
0.
.
SIP/2.0
200 OK.
Session-Expires:
3600;refresher=uas.
Require:
timer.
Via:
SIP/2.0/UDP 2.0.0.1:5060;branch=z9hG4bK887c.94fdcd27.0.
Via:
SIP/2.0/UDP
1.1.1.1:5060;branch=z9hG4bK4bd52990;rport=5060.
CSeq:
102 INVITE.
Allow:
INVITE, BYE, OPTIONS, CANCEL, ACK, REGISTER, NOTIFY,
INFO, REFER, SUBSCRIBE, PRACK, UPDATE.
Call-Info:
<sip:3.1.1.2>;method="NOTIFY;Event=telephone-event;Duration=1000".
Allow-Events:
telephone-event.
Content-Type:
application/sdp.
Content-Length:
202.
.
v=0.
o=MSXB
4755 8544 IN IP4 3.1.1.2.
s=sip
call.
c=IN
IP4 204.15.40.111.
t=0
0.
m=audio
33408 RTP/AVP 0 101.
a=rtpmap:0
PCMU/8000.
a=rtpmap:101
telephone-event/8000.
a=fmtp:101
0-16.
a=ptime:20.
SIP/2.0
200 OK.
Session-Expires:
3600;refresher=uas.
Require:
timer.
Via:
SIP/2.0/UDP
1.1.1.1:5060;branch=z9hG4bK4bd52990;rport=5060.
CSeq:
102 INVITE.
Allow:
INVITE, BYE, OPTIONS, CANCEL, ACK, REGISTER, NOTIFY,
INFO, REFER, SUBSCRIBE, PRACK, UPDATE.
Call-Info:
<sip:3.1.1.2>;method="NOTIFY;Event=telephone-event;Duration=1000".
Allow-Events:
telephone-event.
Content-Type:
application/sdp.
Content-Length:
202.
.
v=0.
o=MSXB
4755 8544 IN IP4 3.1.1.2.
s=sip
call.
c=IN
IP4 204.15.40.111.
t=0
0.
m=audio
33408 RTP/AVP 0 101.
a=rtpmap:0
PCMU/8000.
a=rtpmap:101
telephone-event/8000.
a=fmtp:101
0-16.
a=ptime:20.
Via:
SIP/2.0/UDP 1.1.1.1:5060;branch=z9hG4bK3fc3c548;rport.
Max-Forwards:
70.
CSeq:
102 ACK.
User-Agent:
Asterisk PBX 1.8.15-cert2.
Content-Length:
0.
.
Via:
SIP/2.0/UDP 2.0.0.1:5060;branch=z9hG4bKcydzigwkX.
Via:
SIP/2.0/UDP
1.1.1.1:5060;branch=z9hG4bK3fc3c548;rport=5060.
Max-Forwards:
16.
CSeq:
102 ACK.
User-Agent:
Asterisk PBX 1.8.15-cert2.
Content-Length:
0.
.
SIP/2.0
200 OK.
Session-Expires:
3600;refresher=uas.
Require:
timer.
Via:
SIP/2.0/UDP 2.0.0.1:5060;branch=z9hG4bK887c.94fdcd27.0.
Via:
SIP/2.0/UDP
1.1.1.1:5060;branch=z9hG4bK4bd52990;rport=5060.
CSeq:
102 INVITE.
Allow:
INVITE, BYE, OPTIONS, CANCEL, ACK, REGISTER, NOTIFY,
INFO, REFER, SUBSCRIBE, PRACK, UPDATE.
Call-Info:
<sip:3.1.1.2>;method="NOTIFY;Event=telephone-event;Duration=1000".
Allow-Events:
telephone-event.
Content-Type:
application/sdp.
Content-Length:
202.
.
v=0.
o=MSXB
4755 8544 IN IP4 3.1.1.2.
s=sip
call.
c=IN
IP4 204.15.40.111.
t=0
0.
m=audio
33408 RTP/AVP 0 101.
a=rtpmap:0
PCMU/8000.
a=rtpmap:101
telephone-event/8000.
a=fmtp:101
0-16.
a=ptime:20.
SIP/2.0
200 OK.
Session-Expires:
3600;refresher=uas.
Require:
timer.
Via:
SIP/2.0/UDP
1.1.1.1:5060;branch=z9hG4bK4bd52990;rport=5060.
CSeq:
102 INVITE.
Allow:
INVITE, BYE, OPTIONS, CANCEL, ACK, REGISTER, NOTIFY,
INFO, REFER, SUBSCRIBE, PRACK, UPDATE.
Call-Info:
<sip:3.1.1.2>;method="NOTIFY;Event=telephone-event;Duration=1000".
Allow-Events:
telephone-event.
Content-Type:
application/sdp.
Content-Length:
202.
.
v=0.
o=MSXB
4755 8544 IN IP4 3.1.1.2.
s=sip
call.
c=IN
IP4 204.15.40.111.
t=0
0.
m=audio
33408 RTP/AVP 0 101.
a=rtpmap:0
PCMU/8000.
a=rtpmap:101
telephone-event/8000.
a=fmtp:101
0-16.
a=ptime:20.
Via:
SIP/2.0/UDP 1.1.1.1:5060;branch=z9hG4bK280c4e9c;rport.
Max-Forwards:
70.
CSeq:
102 ACK.
User-Agent:
Asterisk PBX 1.8.15-cert2.
Content-Length:
0.
.
Via:
SIP/2.0/UDP 2.0.0.1:5060;branch=z9hG4bKcydzigwkX.
Via:
SIP/2.0/UDP
1.1.1.1:5060;branch=z9hG4bK280c4e9c;rport=5060.
Max-Forwards:
16.
CSeq:
102 ACK.
User-Agent:
Asterisk PBX 1.8.15-cert2.
Content-Length:
0.
.
Max-Forwards:
69.
CSeq:
2 BYE.
Allow:
INVITE, BYE, OPTIONS, CANCEL, ACK, REGISTER, NOTIFY,
INFO, REFER, SUBSCRIBE, PRACK, UPDATE.
Via:
SIP/2.0/UDP 3.1.1.1:5060;branch=z9hG4bKce8a.db93afa3.0.
Via:
SIP/2.0/UDP
3.1.1.2:5060;branch=z9hG4bK96003ecbb11f5deaf6014235140e6952.
Content-Length:
0.
.
Max-Forwards:
16.
CSeq:
2 BYE.
Allow:
INVITE, BYE, OPTIONS, CANCEL, ACK, REGISTER, NOTIFY,
INFO, REFER, SUBSCRIBE, PRACK, UPDATE.
Via:
SIP/2.0/UDP 2.0.0.1:5060;branch=z9hG4bKce8a.52d22d63.0.
Via:
SIP/2.0/UDP 3.1.1.1:5060;branch=z9hG4bKce8a.db93afa3.0.
Via:
SIP/2.0/UDP
3.1.1.2:5060;branch=z9hG4bK96003ecbb11f5deaf6014235140e6952.
Content-Length:
0.
.