Hi Mates,I am testing a Client in Nokia E65 using kamailio 1.3.3. I managed
to successfull get it Registered but when i attempt to make a call i always
get the "404 Not Found" message in the INVITE. Strangely enough, the Client
appears to still be ONLINE in the location table.
################################
kamailio config below
##############################
if(!is_method("REGISTER")){
if(nat_uac_test("19")){
record_route(";nat=yes");
} else {
record_route();
};
};
##Loose_route packets
if (has_totag()) {
#sequential request withing a dialog should
# take the path determined by record-routing
if (loose_route()) {
if(method=="BYE") {
#Account BYE transactions
setflag(2);
};
#Check authentication of re-invites
if(method=="INVITE" && (!allow_trusted())) {
if (!proxy_authorize("","subscriber")) {
proxy_challenge("","0");
exit;
} else if (!check_from()) {
sl_send_reply("403", "Forbidden, use From=ID");
exit;
};
};
if(method=="BYE" || method=="CANCEL") {
end_media_session();
};
##Detect requests in the dialog behind NAT and flag with 6
if(nat_uac_test("19") || search("^Route:.*;nat=yes")){
append_hf("P-hint: LR|fixcontact,setflag6\r\n");
fix_contact();
setflag(6);
};
route(1);
} else {
sl_send_reply("404","Not here");
}
exit;
}
##Loose_route packets
if (loose_route()) {
if(!has_totag()){
sl_send_reply("403", "Initial Loose-Routing Rejected");
exit;
};
route(1);
};
#CANCEL processing
if (is_method("CANCEL")) {
if (t_check_trans()) {
end_media_session();
t_relay();
};
exit;
}
t_check_trans();
#
# -- 3 -- Determine Request Target
#
if (method=="REGISTER") {
route(2);
} else {
route(3);
};
}
route[1] {
#
# -- 4 -- Forward request to target
#
# Forward statefully
t_on_reply("1");
t_on_failure("1");
if (!t_relay()) {
# sl_reply_error();
};
exit;
}
route[2] {
## Register request handler
if (is_uri_host_local()) {
if (!www_authorize("", "subscriber")) {
www_challenge("", "0");
exit;
};
if (!check_to()) {
sl_send_reply("403", "Forbidden");
exit;
};
if(!search("^Contact:[ ]*\*") && client_nat_test("7"))
{
setflag(6);
fix_nated_register();
force_rport();
};
save("location");
exit;
} else if {
sl_send_reply("403", "Forbidden");
};
}
route[3] {
## Requests handler
if (method=="INVITE") {
# Account INVITE packets
setflag(2);
# Account Missed calls
setflag(3);
# Radius Extra
# $avp(s:sip_proxy_ip)="127.0.0.1";
};
if (is_from_local()){
# From an internal domain -> check the credentials and the FROM
if(!allow_trusted()){
if (!proxy_authorize("","subscriber")) {
proxy_challenge("","0");
exit;
} else if(!check_from()) {
sl_send_reply("403", "Forbidden, use From=ID");
exit;
};
};
if (client_nat_test("3")) {
append_hf("P-hint:
route(3)|setflag7,forcerport,fix_contact\r\n");
setflag(7);
force_rport();
fix_contact();
};
#unconditional call forward
if(avp_db_load("$ru/username","$avp(s:callfwd)")) {
avp_pushto("$ru", "$avp(s:callfwd)");
route(1);
exit;
}
consume_credentials();
#verify aliases, if found replace R-URI.
lookup("aliases");
if (is_uri_host_local()) {
# -- Inbound to Inbound
route(10);
} else {
# -- Inbound to outbound
route(11);
};
} else {
#From an external domain ->do not check credentials
#Verify aliases, if found replace R-URI.
lookup("aliases");
if (is_uri_host_local()) {
#-- Outbound to inbound
route(12);
} else {
# -- Outbound to outbound
route(13);
};
};
}
route[4] {
# routing to the public network
rewritehostport("xx.xxx.xxx.xx:5065");
#t_on_failure("2");
if (!t_relay()) {
sl_reply_error();
};
exit;
}
route[6] {
#
# -- NAT handling --
#
if (isflagset(6) || isflagset(7)) {
append_hf("P-hint: Route[6]: mediaproxy \r\n");
use_media_proxy();
};
}
route[10] {
#from an internal domain -> inbound
#Native SIP destinations are handled using the location table
#Gateway destinations are handled by regular expressions
append_hf("P-hint: inbound->inbound \r\n");
if (uri=~"^sip:0[1-9][0-9]*@") {
if (is_user_in("credentials","local")) {
strip(1);
prefix("27");
route(6);
route(4);
exit;
} else {
sl_send_reply("403", "No permissions for local calls");
exit;
};
};
if (uri=~"^sip:00[1-9][0-9]*@") {
if (is_user_in("credentials","int")) {
strip(2);
route(6);
route(4);
exit;
} else {
sl_send_reply("403", "No permissions for international
calls");
};
};
if (!lookup("location")) {
route(6);
route(1);
} else {
sl_send_reply("404", "Not Found");
exit;
};
route(6);
route(1);
}
route[11] {
# from an internal domain -> outbound
# Simply route the call outbound using DNS search
append_hf("P-hint: inbound->outbound \r\n");
route(1);
}
route[12] {
# From an external domain -> inbound
# Verify aliases, if found replace R-URI.
lookup("aliases");
if (!lookup("location")) {
sl_send_reply("404", "Not Found");
exit;
};
route(1);
}
route[13] {
#From an external domain outbound
#we are not accepting these calls
append_hf("P-hint: outbound->inbound \r\n");
sl_send_reply("403", "Forbidden");
exit;
}
failure_route[1] {
##--
##-- If cancelled, exit.
##--
if (t_was_cancelled()) {
exit;
};
##--
##-- If busy send to the e-mail server, prefix the "b"
##-- character to indicate busy.
##--
if (t_check_status("486")) {
revert_uri();
prefix("b");
rewritehostport("xx.xxx.xxx.xx:5065");
append_branch();
route(1);
exit;
};
##--
##-- If timeout (408) or unavailable temporarily (480),
##-- prefix the uri with the "u"character to indicate
##-- unanswered and send to the e-mail
##-- sever
##--
if (t_check_status("408") || t_check_status("480")) {
revert_uri();
prefix("u");
rewritehostport("xx.xxx.xxx.xx:5065");
append_branch();
route(1);
exit;
};
}
failure_route[2] {
t_on_failure("2");
t_relay();
}
onreply_route[1] {
#
#-- On-replay block routing --
#
if (client_nat_test("1")) {
append_hf("P-hint: Onreply-route - fixcontact \r\n");
fix_contact();
};
if ((isflagset(6) || isflagset(7)) &&
(status=~"(180)|(183)|2[0-9][0-9]")) {
if (search("^Content-Type:[ ]*application/sdp")) {
append_hf("P-hint: onreply_route|usemediaproxy \r\n");
use_media_proxy();
};
};
exit;
}
######################################################################
Captured Invite packets below.
#####################################################################
.
U 2008/12/12 20:41:19.227089 41.23.215.255:5060 -> xx.xxx.xxx.xx:5060
INVITE sip:0123825710@xx.xxx.xxx.xx SIP/2.0.
Via: SIP/2.0/UDP 41.23.215.255:5060
;branch=z9hG4bK5lvrd249rhhc6dbif4j3i48;rport.
From: <sip:1974@10.20.11.62 <sip%3A1974(a)10.20.11.62>
;tag=gm8rd21tl9hc68h6f4j2.
To:
<sip:0123825710@xx.xxx.xxx.xx>.
Contact: <sip:1974@41.23.215.255 <sip%3A1974(a)41.23.215.255>>5>>.
Accept-Contact: *;+media=audio.
CSeq: 953 INVITE.
Call-ID: -u6Sy5l7oIf2mTACTYE46_z8sRn-_f.
User-Agent: Tuune Mobile.
Max-Forwards: 70.
Content-Type: application/sdp.
Content-Length: 172.
.
v=0.
o=- 54865261 0 IN IP4 41.23.215.255.
s=Tuune Mobile.
c=IN IP4 41.23.215.255.
t=0 0.
m=audio 5000 RTP/AVP 0 97.
a=sendrecv.
a=rtpmap:0 PCMU/8000.
a=rtpmap:97 AMR/8000.
U 2008/12/12 20:41:19.227945 xx.xxx.xxx.xx:5060 -> 41.23.215.255:5060
SIP/2.0 404 Not Found.
Via: SIP/2.0/UDP 41.23.215.255:5060
;branch=z9hG4bK5lvrd249rhhc6dbif4j3i48;rport=
5060.
From: <sip:1974@10.20.11.62 <sip%3A1974(a)10.20.11.62>
;tag=gm8rd21tl9hc68h6f4j2.
To:
<sip:0123825710@xx.xxx.xxx.xx
;tag=329cfeaa6ded039da25ff8cbb8668bd2.bf78.
CSeq:
953 INVITE.
Call-ID: -u6Sy5l7oIf2mTACTYE46_z8sRn-_f.
Server:Tuune Mobile Test.
Content-Length: 0.
.
####################################
It is online
############
41:/# openserctl ul show
database engine 'MYSQL' loaded
Control engine 'FIFO' loaded
entering fifo_cmd ul_dump
Domain:: aliases table=512 records=0 max_slot=0
Domain:: location table=512 records=1 max_slot=1
AOR:: 1974
Contact:: sip:1974@41.22.248.8 <sip%3A1974(a)41.22.248.8> Q=
Expires:: 932
Callid:: x1ySy9r2oIf1Ogj2Uzeht2FSEcYGxE
Cseq:: 957
User-agent:: n/a
State:: CS_SYNC
Flags:: 0
Cflag:: 0
Socket:: udp:xx.xxx.xxx.xx:5060
Methods:: 4294967295
FIFO command was:
:ul_dump:openser_receiver_15196
I hope some one can give a clue,
WBR,
Lu.
--
Luzango Mfupe
TUUNE MOBILE
Tel:0128440528/0123825710
Tshwane-RSA
"...Ships are safe in harbor, but they were never meant to stay
there......."