Hi all...
Well I have made some progress... Bellow is my routing statement:
route{ if (!mf_process_maxfwd_header("10")) { sl_send_reply("483","Too Many Hops"); break; }; if (msg:len >= 2048 ) { sl_send_reply("513", "Message too big"); break; }; if (!method=="REGISTER") record_route(); if (loose_route()) { append_hf("P-hint: rr-enforced\r\n"); route(1); break; };
if (!uri==myself) { append_hf("P-hint: outbound\r\n"); route(1); break; }; if (uri==myself) {
if (method=="REGISTER") {
save("location"); break; };
lookup("aliases"); if (!uri==myself) { append_hf("P-hint: outbound alias\r\n"); route(1); break; }; }; append_hf("P-hint: usrloc applied\r\n"); route(1); }
route[1] { if (src_ip==10.98.6.5) { if (dst_port==5065) { t_relay_to_tcp("10.98.118.20", "5065"); } else if (dst_port==5066) { t_relay_to_tcp("10.98.118.20", "5066"); } else if (dst_port==5067) { t_relay_to_tcp("10.98.118.20", "5067"); } else { t_relay_to_tcp("10.98.118.20", "5060"); } } else { t_relay_to_udp("10.98.6.5", "5060"); }; }
When asterisk sends a call to kamailio, Kamailio then sends the invite to 10.98.118.20 via TCP on port 5061. INVITE sip:1989@10.98.6.5:5061 SIP/2.0 Record-Route: sip:10.98.6.5:5065;transport=tcp;r2=on;lr=on Record-Route: sip:10.98.6.5:5061;r2=on;lr=on Via: SIP/2.0/TCP 10.98.6.5:5065;branch=z9hG4bK74fd.a4578a84.0 Via: SIP/2.0/UDP 10.98.6.5:5060;branch=z9hG4bK7b9bb22d;rport=5060 From: "1103" sip:1103@10.98.6.5;tag=as4ae41ccf To: sip:1989@10.98.6.5:5061 Contact: sip:1103@10.98.6.5 Call-ID: 44073b911e86b0a96c9104cb7a5ec389@10.98.6.5 CSeq: 102 INVITE User-Agent: Asterisk PBX Max-Forwards: 69 Date: Fri, 21 May 2010 12:23:58 GMT Allow: INVITE, ACK, CANCEL, OPTIONS, BYE, REFER, SUBSCRIBE, NOTIFY, INFO Supported: replaces Content-Type: application/sdp Content-Length: 232 P-hint: usrloc applied
The problem is that the Kamailio receives a 302 Moved Temporarily with a contact field of CONTACT: sip:1989@10.98.6.5:5065;transport=TCP I need to have Kamailio, use this contact field and re-send the invite.
How can this be done?
Nelson Pereira Senior Network Specialist
Protushttp://www.protus.com/ npereira@protus.commailto:name@protus.com phone: 613.733.0000 ext.528 MyFax: 613.822.5083
MyFax.comhttp://www.myfax.com/ | my1voice.comhttp://www.my1voice.com/ | Campaigner.comhttp://www.campaigner.com/
Am 21.05.2010 14:33, schrieb Nelson Pereira:
The problem is that the Kamailio receives a 302 Moved Temporarily with a contact field of CONTACT: sip:1989@10.98.6.5:5065;transport=TCP
I need to have Kamailio, use this contact field and re-send the invite.
How can this be done?
Use get_redirects() frunction
http://www.kamailio.org/docs/modules/3.0.x/modules_k/uac_redirect.html#id294...
regards klaus
Im not a code expert or a kamailio expert, so where and how do I intergrate this function in my current routing logic?
# main request routing logic
route{ if (!mf_process_maxfwd_header("10")) { sl_send_reply("483","Too Many Hops"); break; }; if (msg:len >= 2048 ) { sl_send_reply("513", "Message too big"); break; };
if (!method=="REGISTER") record_route(); if (loose_route()) { append_hf("P-hint: rr-enforced\r\n"); route(1); break; };
if (uri==myself) {
if (method=="REGISTER") {
save("location"); break; };
append_hf("P-hint: usrloc applied\r\n"); route(1); }
route[1] { if (src_ip==10.98.6.5) { if (dst_port==5065) { t_relay_to_tcp("10.98.118.20", "5065"); } else if (dst_port==5066) { t_relay_to_tcp("10.98.118.20", "5066"); } else if (dst_port==5067) { t_relay_to_tcp("10.98.118.20", "5067"); } else { t_relay_to_tcp("10.98.118.20", "5060"); } } else { t_relay_to_udp("10.98.6.5", "5060"); }; }
Nelson Pereira
-----Original Message----- From: Klaus Darilion [mailto:klaus.mailinglists@pernau.at] Sent: Friday, May 21, 2010 9:20 AM To: Nelson Pereira Cc: users@lists.kamailio.org Subject: Re: [SR-Users] Need help with route statement
Am 21.05.2010 14:33, schrieb Nelson Pereira:
The problem is that the Kamailio receives a 302 Moved Temporarily with a contact field of CONTACT: sip:1989@10.98.6.5:5065;transport=TCP
I need to have Kamailio, use this contact field and re-send the invite.
How can this be done?
Use get_redirects() frunction
http://www.kamailio.org/docs/modules/3.0.x/modules_k/uac_redirect.html#id294...
regards klaus
I did the following changed by adding the get_redirects function (see bellow) but now im getting a 500 server error:
SIP/2.0 500 Internal Server Error FROM: "1102"sip:1102@10.98.6.5;tag=as60aba076 TO: sip:1989@10.98.6.5:5061;tag=f5f4ad2a5d CSEQ: 102 INVITE CALL-ID: 206fed5108bdcd2d2bb5255217713ca7@10.98.6.5 VIA: SIP/2.0/TCP 10.98.6.5;branch=z9hG4bKd9ef.ed1ee9d5.0;i=3,SIP/2.0/TCP 10.98.6.5;branch=z9hG4bKd9ef.dd1ee9d5.1,SIP/2.0/UDP 10.98.6.5:5060;branch=z9hG4bK3557f87f;rport=5060 CONTENT-LENGTH: 0 SERVER: RTCC/3.0.0.0
# main request routing logic
route{ if (!mf_process_maxfwd_header("10")) { sl_send_reply("483","Too Many Hops"); break; }; if (msg:len >= 2048 ) { sl_send_reply("513", "Message too big"); break; };
if (!method=="REGISTER") record_route(); if (loose_route()) { append_hf("P-hint: rr-enforced\r\n"); route(1); break; };
if (uri==myself) {
if (method=="REGISTER") {
save("location"); break; };
# do redirect with accounting t_on_failure("2"); } else { # just do redirect t_on_failure("1"); }
append_hf("P-hint: usrloc applied\r\n"); route(3); }
failure_route[1] { get_redirects("3:1"); t_relay(); }
failure_route[2] { get_redirects("6:2","redirect"); t_relay(); }
route[3] { if (src_ip==10.98.6.5) { if (dst_port==5065) { t_relay_to_tcp("10.98.118.20", "5065"); } else if (dst_port==5066) { t_relay_to_tcp("10.98.118.20", "5066"); } else if (dst_port==5067) { t_relay_to_tcp("10.98.118.20", "5067"); } else { t_relay_to_tcp("10.98.118.20", "5060"); } } else { t_relay_to_udp("10.98.6.5", "5060"); }; }
Nelson Pereira
Hi!
Please post the complete SIP trace of the scenario which does not work, this means:
incoming INVITE, outgoing INVITE, incoming response, outgoing response
also you can increase loglevel (debug=3 for kamailio 3.0, debug=4 for kamailio 1.5) and watch syslog.
regards klaus
On 21.05.2010 16:37, Nelson Pereira wrote:
I did the following changed by adding the get_redirects function (see bellow) but now im getting a 500 server error:
SIP/2.0 500 Internal Server Error FROM: "1102"sip:1102@10.98.6.5;tag=as60aba076 TO:sip:1989@10.98.6.5:5061;tag=f5f4ad2a5d CSEQ: 102 INVITE CALL-ID: 206fed5108bdcd2d2bb5255217713ca7@10.98.6.5 VIA: SIP/2.0/TCP 10.98.6.5;branch=z9hG4bKd9ef.ed1ee9d5.0;i=3,SIP/2.0/TCP 10.98.6.5;branch=z9hG4bKd9ef.dd1ee9d5.1,SIP/2.0/UDP 10.98.6.5:5060;branch=z9hG4bK3557f87f;rport=5060 CONTENT-LENGTH: 0 SERVER: RTCC/3.0.0.0
# main request routing logic
route{ if (!mf_process_maxfwd_header("10")) { sl_send_reply("483","Too Many Hops"); break; }; if (msg:len>= 2048 ) { sl_send_reply("513", "Message too big"); break; };
if (!method=="REGISTER") record_route(); if (loose_route()) { append_hf("P-hint: rr-enforced\r\n"); route(1); break; }; if (uri==myself) { if (method=="REGISTER") { save("location"); break; }; # do redirect with accounting t_on_failure("2"); } else { # just do redirect t_on_failure("1"); } append_hf("P-hint: usrloc applied\r\n"); route(3);
}
failure_route[1] { get_redirects("3:1"); t_relay(); }
failure_route[2] { get_redirects("6:2","redirect"); t_relay(); }
route[3] { if (src_ip==10.98.6.5) { if (dst_port==5065) { t_relay_to_tcp("10.98.118.20", "5065"); } else if (dst_port==5066) { t_relay_to_tcp("10.98.118.20", "5066"); } else if (dst_port==5067) { t_relay_to_tcp("10.98.118.20", "5067"); } else { t_relay_to_tcp("10.98.118.20", "5060"); } } else { t_relay_to_udp("10.98.6.5", "5060"); }; }
Nelson Pereira
SIP Express Router (SER) and Kamailio (OpenSER) - sr-users mailing list sr-users@lists.sip-router.org http://lists.sip-router.org/cgi-bin/mailman/listinfo/sr-users