I am getting a weird issue when I use the LCR modules and I am not sure if its a bug in the module or my config. It only happens when the first leg has failed the invite and it jumps to the failure route and tries the next gateway on the list.
The bug is in the "c=IN IPV4" line in the invite to the second gateway where there should only be one ip address. So it sends the following:
c=IN IPV4 192.168.8.35192.168.8.35.
when it should be:
c=IN IPV4 192.168.8.35.
This makes the second gateway give back a 488 not acceptable back regardless if it can process the call or not as the header is malformed. If the first gateway of choice doesn't give back an error the call will connect just fine as the first invite is correctly formatted (which makes me think it is something to do with how I process the failure route that is at fault or how the lcr does it - just can't figure out which).
Below is the sip message flow that I get (I made the first gateway give back a 404 not found to test the lcr failover).
Call flow is supposed to be:
PH-A = 2958770000 (Caller, 192.168.10.30 [Nat Inside], 192.168.7.250 [Nat Outside]) PH-B = 2959770000 (Called, PSTN) GW-A = 192.168.8.6 GW-B = 192.168.35.18 SER = 192.168.8.35
PH-A -> SER (INVITE - Good) PH-A <- SER (100 Trying - Good) SER -> GW-A (INVITE - Good) SER <- GW-A (100 Trying - Good) SER <- GW-A (404 Not Found - Good) SER -> GW-A (ACK - Good) SER -> GW-B (INVITE - Malformed) SER <- GW-B (488 Not Acceptable - Due To Malformed Header) ...
Then the call fails due to no more gateways as expected.
Any ideas what is causing this (my config is mainly based on the onsip pstn example with lcr extras)?
U 192.168.7.250:61903 -> 192.168.8.35:5060 INVITE sip:2959770000@192.168.8.35 SIP/2.0. Via: SIP/2.0/UDP 192.168.10.30:5060;branch=z9hG4bK-701a9765. From: 2958770000 sip:2958770000@192.168.8.35;tag=d0ff6100e33025ado0. To: sip:2959770000@192.168.8.35. Call-ID: c19d05bc-82926821@192.168.10.30. CSeq: 101 INVITE. Max-Forwards: 70. Contact: 2958770000 sip:2958770000@192.168.10.30:5060. Expires: 240. User-Agent: Linksys/PAP2-2.0.13(LSb). Content-Length: 286. Allow: ACK, BYE, CANCEL, INFO, INVITE, NOTIFY, OPTIONS, REFER. Supported: x-sipura. Content-Type: application/sdp. . v=0. o=- 712750 712750 IN IP4 192.168.10.30. s=-. c=IN IP4 192.168.10.30. t=0 0. m=audio 16430 RTP/AVP 18 0 8 100 101. a=rtpmap:18 G729a/8000. a=rtpmap:0 PCMU/8000. a=rtpmap:8 PCMA/8000. a=rtpmap:100 NSE/8000. a=rtpmap:101 telephone-event/8000. a=fmtp:101 0-15. a=ptime:30. a=sendrecv.
U 192.168.8.35:5060 -> 192.168.7.250:61903 SIP/2.0 100 trying -- your call is important to us. Via: SIP/2.0/UDP 192.168.10.30:5060;branch=z9hG4bK-701a9765;rport=61903;received=192.168.7.25 0. From: 2958770000 sip:2958770000@192.168.8.35;tag=d0ff6100e33025ado0. To: sip:2959770000@192.168.8.35. Call-ID: c19d05bc-82926821@192.168.10.30. CSeq: 101 INVITE. Server: Sip Express Router (0.9.4 - i386/linux). Content-Length: 0. .
U 192.168.8.35:5060 -> 192.168.8.6:5060 INVITE sip:12959770000@192.168.8.6 SIP/2.0. Record-Route: sip:2959770000@192.168.8.35:5060;nat=yes;ftag=d0ff6100e33025ado0;lr=on. Via: SIP/2.0/UDP 192.168.8.35;branch=z9hG4bK1128.6389a122.0. Via: SIP/2.0/UDP 192.168.10.30:5060;rport=61903;received=192.168.7.250;branch=z9hG4bK-701a976 5. From: 2958770000 sip:2958770000@192.168.8.35;tag=d0ff6100e33025ado0. To: sip:2959770000@192.168.8.35. Call-ID: c19d05bc-82926821@192.168.10.30. CSeq: 101 INVITE. Max-Forwards: 16. Contact: 2958770000 sip:2958770000@192.168.7.250:61903. Expires: 240. User-Agent: Linksys/PAP2-2.0.13(LSb). Content-Length: 284. Allow: ACK, BYE, CANCEL, INFO, INVITE, NOTIFY, OPTIONS, REFER. Supported: x-sipura. Content-Type: application/sdp. . v=0. o=- 712750 712750 IN IP4 192.168.10.30. s=-. c=IN IP4 192.168.8.35. t=0 0. m=audio 35040 RTP/AVP 18 0 8 100 101. a=rtpmap:18 G729a/8000. a=rtpmap:0 PCMU/8000. a=rtpmap:8 PCMA/8000. a=rtpmap:100 NSE/8000. a=rtpmap:101 telephone-event/8000. a=fmtp:101 0-15. a=ptime:30. a=sendrecv.
U 192.168.8.6:50183 -> 192.168.8.35:5060 SIP/2.0 100 Trying. Via: SIP/2.0/UDP 192.168.8.35;branch=z9hG4bK1128.6389a122.0,SIP/2.0/UDP 192.168.10.30:5060;rport=61903;received=192.168.7.250;branch=z9hG4bK-701a976 5. From: 2958770000 sip:2958770000@192.168.8.35;tag=d0ff6100e33025ado0. To: sip:2959770000@192.168.8.35;tag=22C61F2C-2339. Date: Thu, 08 Sep 2005 21:06:38 GMT. Call-ID: c19d05bc-82926821@192.168.10.30. Server: Cisco-SIPGateway/IOS-12.x. CSeq: 101 INVITE. Allow-Events: telephone-event. Content-Length: 0. .
U 192.168.8.6:50183 -> 192.168.8.35:5060 SIP/2.0 404 Not Found. Via: SIP/2.0/UDP 192.168.8.35;branch=z9hG4bK1128.6389a122.0,SIP/2.0/UDP 192.168.10.30:5060;rport=61903;received=192.168.7.250;branch=z9hG4bK-701a976 5. From: 2958770000 sip:2958770000@192.168.8.35;tag=d0ff6100e33025ado0. To: sip:2959770000@192.168.8.35;tag=22C61F2C-2339. Date: Thu, 08 Sep 2005 21:06:38 GMT. Call-ID: c19d05bc-82926821@192.168.10.30. Server: Cisco-SIPGateway/IOS-12.x. CSeq: 101 INVITE. Allow-Events: telephone-event. Reason: Q.850;cause=3. Content-Length: 0. .
U 192.168.8.35:5060 -> 192.168.8.6:5060 ACK sip:12959770000@192.168.8.6 SIP/2.0. Via: SIP/2.0/UDP 192.168.8.35;branch=z9hG4bK1128.6389a122.0. From: 2958770000 sip:2958770000@192.168.8.35;tag=d0ff6100e33025ado0. Call-ID: c19d05bc-82926821@192.168.10.30. To: sip:2959770000@192.168.8.35;tag=22C61F2C-2339. CSeq: 101 ACK. User-Agent: Sip Express Router (0.9.4 - i386/linux). Content-Length: 0. .
U 192.168.8.35:5060 -> 192.168.35.18:5060 INVITE sip:12959770000@192.168.35.18 SIP/2.0. Record-Route: sip:2959770000@192.168.8.35:5060;nat=yes;ftag=d0ff6100e33025ado0;lr=on. Via: SIP/2.0/UDP 192.168.8.35;branch=z9hG4bK1128.6389a122.1. Via: SIP/2.0/UDP 192.168.10.30:5060;rport=61903;received=192.168.7.250;branch=z9hG4bK-701a976 5. From: 2958770000 sip:2958770000@192.168.8.35;tag=d0ff6100e33025ado0. To: sip:2959770000@192.168.8.35. Call-ID: c19d05bc-82926821@192.168.10.30. CSeq: 101 INVITE. Max-Forwards: 16. Contact: 2958770000 sip:2958770000@192.168.7.250:61903. Expires: 240. User-Agent: Linksys/PAP2-2.0.13(LSb). Content-Length: 300. Allow: ACK, BYE, CANCEL, INFO, INVITE, NOTIFY, OPTIONS, REFER. Supported: x-sipura. Content-Type: application/sdp. . v=0. o=- 712750 712750 IN IP4 192.168.10.30. s=-. c=IN IP4 192.168.8.35192.168.8.35. t=0 0. m=audio 3504035040 RTP/AVP 18 0 8 100 101. a=rtpmap:18 G729a/8000. a=rtpmap:0 PCMU/8000. a=rtpmap:8 PCMA/8000. a=rtpmap:100 NSE/8000. a=rtpmap:101 telephone-event/8000. a=fmtp:101 0-15. a=ptime:30. a=sendrecv.
U 192.168.35.18:5060 -> 192.168.8.35:5060 SIP/2.0 488 Not acceptable here. Via: SIP/2.0/UDP 192.168.8.35;branch=z9hG4bK1128.6389a122.1. Via: SIP/2.0/UDP 192.168.10.30:5060;received=192.168.7.250;branch=z9hG4bK-701a9765. From: 2958770000 sip:2958770000@192.168.8.35;tag=d0ff6100e33025ado0. To: sip:2959770000@192.168.8.35;tag=as113c57f8. Call-ID: c19d05bc-82926821@192.168.10.30. CSeq: 101 INVITE. User-Agent: Video PBX. Allow: INVITE, ACK, CANCEL, OPTIONS, BYE, REFER. Contact: sip:12959770000@192.168.35.18. Content-Length: 0. .
U 192.168.8.35:5060 -> 192.168.35.18:5060 ACK sip:12959770000@192.168.35.18 SIP/2.0. Via: SIP/2.0/UDP 192.168.8.35;branch=z9hG4bK1128.6389a122.1. From: 2958770000 sip:2958770000@192.168.8.35;tag=d0ff6100e33025ado0. Call-ID: c19d05bc-82926821@192.168.10.30. To: sip:2959770000@192.168.8.35;tag=as113c57f8. CSeq: 101 ACK. User-Agent: Sip Express Router (0.9.4 - i386/linux). Content-Length: 0. .
U 192.168.8.35:5060 -> 192.168.7.250:61903 SIP/2.0 503 Service Temporarilly Unavailable, No More Available Gateways. Via: SIP/2.0/UDP 192.168.10.30:5060;branch=z9hG4bK-701a9765;rport=61903;received=192.168.7.25 0. From: 2958770000 sip:2958770000@192.168.8.35;tag=d0ff6100e33025ado0. To: sip:2959770000@192.168.8.35;tag=d1bd3b96fe18e5f9baf4949f8e4468f7-0b42. Call-ID: c19d05bc-82926821@192.168.10.30. CSeq: 101 INVITE. Server: Sip Express Router (0.9.4 - i386/linux). Content-Length: 0. .
U 192.168.7.250:61903 -> 192.168.8.35:5060 ACK sip:2959770000@192.168.8.35 SIP/2.0. Via: SIP/2.0/UDP 192.168.10.30:5060;branch=z9hG4bK-701a9765. From: 2958770000 sip:2958770000@192.168.8.35;tag=d0ff6100e33025ado0. To: sip:2959770000@192.168.8.35;tag=d1bd3b96fe18e5f9baf4949f8e4468f7-0b42. Call-ID: c19d05bc-82926821@192.168.10.30. CSeq: 101 ACK. Max-Forwards: 70. Contact: 2958770000 sip:2958770000@192.168.10.30:5060. User-Agent: Linksys/PAP2-2.0.13(LSb). Content-Length: 0. .
# ----------------------------------------------------------------- # Standard Settings # -----------------------------------------------------------------
debug = 3 children = 1 fork = no log_stderror = yes check_via = no dns = no rev_dns = no sip_warning = no
# ----------------------------------------------------------------- # Server Settings # -----------------------------------------------------------------
port = 5060 listen = 192.168.8.35 alias = 192.168.8.35
# ----------------------------------------------------------------- # Fifo Settings # -----------------------------------------------------------------
fifo = "/tmp/ser_fifo" fifo_mode = 0666 fifo_db_url = "mysql://root:password@192.168.8.35/ser"
# ----------------------------------------------------------------- # Module Settings # -----------------------------------------------------------------
loadmodule "/usr/lib/ser/modules/sl.so" loadmodule "/usr/lib/ser/modules/tm.so" loadmodule "/usr/lib/ser/modules/rr.so" loadmodule "/usr/lib/ser/modules/auth.so" loadmodule "/usr/lib/ser/modules/auth_db.so" loadmodule "/usr/lib/ser/modules/auth_radius.so" loadmodule "/usr/lib/ser/modules/uri.so" loadmodule "/usr/lib/ser/modules/uri_db.so" loadmodule "/usr/lib/ser/modules/uri_radius.so" loadmodule "/usr/lib/ser/modules/uac.so" loadmodule "/usr/lib/ser/modules/lcr.so" loadmodule "/usr/lib/ser/modules/acc.so" loadmodule "/usr/lib/ser/modules/exec.so" loadmodule "/usr/lib/ser/modules/group.so" loadmodule "/usr/lib/ser/modules/group_radius.so" loadmodule "/usr/lib/ser/modules/avpops.so" loadmodule "/usr/lib/ser/modules/avp_radius.so" loadmodule "/usr/lib/ser/modules/maxfwd.so" loadmodule "/usr/lib/ser/modules/usrloc.so" loadmodule "/usr/lib/ser/modules/domain.so" loadmodule "/usr/lib/ser/modules/textops.so" loadmodule "/usr/lib/ser/modules/options.so" loadmodule "/usr/lib/ser/modules/registrar.so" loadmodule "/usr/lib/ser/modules/nathelper.so" loadmodule "/usr/lib/ser/modules/mediaproxy.so" loadmodule "/usr/lib/ser/modules/permissions.so" loadmodule "/usr/lib/ser/modules/speeddial.so" loadmodule "/usr/lib/ser/modules/mysql.so" loadmodule "/usr/lib/ser/modules/msilo.so" loadmodule "/usr/lib/ser/modules/xlog.so"
# ----------------------------------------------------------------- # Module Parameters # -----------------------------------------------------------------
modparam("auth", "secret", "password") modparam("auth", "nonce_expire", 60) modparam("auth", "rpid_prefix", "") modparam("auth", "rpid_suffix", ";party=calling;id-type=subscriber;screen=yes") modparam("auth", "realm_prefix", "sip.") modparam("auth", "rpid_avp", "i:13")
modparam("auth_db", "db_url", "mysql://root:password@192.168.8.35/ser") modparam("auth_db", "user_column", "username") modparam("auth_db", "domain_column", "domain") modparam("auth_db", "password_column", "password") modparam("auth_db", "password_column_2", "ha1b") modparam("auth_db", "calculate_ha1", 1)
modparam("auth_radius", "radius_config", "/etc/ser/radius/radiusclient.conf") modparam("auth_radius", "service_type", 15)
modparam("uri_db", "db_url", "mysql://root:password@192.168.8.35/ser") modparam("uri_db", "uri_table", "uri") modparam("uri_db", "uri_user_column", "username") modparam("uri_db", "uri_domain_column", "domain") modparam("uri_db", "uri_uriuser_column", "uri_user") modparam("uri_db", "subscriber_table", "subscriber") modparam("uri_db", "subscriber_user_column", "username") modparam("uri_db", "subscriber_domain_column", "domain") modparam("uri_db", "use_uri_table", 0)
modparam("uri_radius", "radius_config", "/etc/ser/radius/radiusclient.conf") modparam("uri_radius", "service_type", 15)
modparam("domain", "db_url", "mysql://root:password@192.168.8.35/ser") modparam("domain", "db_mode", 0) modparam("domain", "domain_table", "domain")
modparam("group", "db_url", "mysql://root:password@192.168.8.35/ser") modparam("group", "table", "grp") modparam("group", "user_column", "username") modparam("group", "domain_column", "domain") modparam("group", "group_column", "grp") modparam("group", "use_domain", 0)
modparam("group_radius", "radius_config", "/etc/ser/radius/radiusclient.conf") modparam("group_radius", "use_domain", 0)
modparam("registrar", "nat_flag", 6) modparam("registrar", "append_branches", 0) modparam("registrar", "case_sensitive", 0) modparam("registrar", "default_expires", 300) modparam("registrar", "default_q", 100) modparam("registrar", "max_contacts", 0) modparam("registrar", "max_expires", 300) modparam("registrar", "min_expires", 60) modparam("registrar", "use_domain", 0) modparam("registrar", "received_avp", 42) modparam("registrar", "received_param", "received") modparam("registrar", "retry_after", 0)
modparam("permissions", "db_url", "mysql://root:password@192.168.8.35/ser") modparam("permissions", "db_mode", 1) modparam("permissions", "trusted_table", "trusted") modparam("permissions", "default_allow_file", "/etc/ser/permissions/allow") modparam("permissions", "default_deny_file", "/etc/ser/permissions/deny") modparam("permissions", "check_all_branches", 1) modparam("permissions", "allow_suffix", ".allow") modparam("permissions", "deny_suffix", ".deny")
modparam("usrloc", "db_url", "mysql://root:password@192.168.8.35/ser") modparam("usrloc", "db_mode", 1) modparam("usrloc", "desc_time_order", 1) modparam("usrloc", "timer_interval", 30) modparam("usrloc", "use_domain", 0) modparam("usrloc", "user_column", "username") modparam("usrloc", "domain_column", "domain") modparam("usrloc", "contact_column", "contact") modparam("usrloc", "expires_column", "expires") modparam("usrloc", "q_column", "q") modparam("usrloc", "callid_column", "callid") modparam("usrloc", "cseq_column", "cseq") modparam("usrloc", "method_column", "method") modparam("usrloc", "flags_column", "flags") modparam("usrloc", "user_agent_column", "user_agent") modparam("usrloc", "received_column", "received")
modparam("avpops", "avp_url", "mysql://root:password@192.168.8.35/ser") modparam("avpops", "avp_aliases", "voicemail=i:500") modparam("avpops", "avp_table", "preferences") modparam("avpops", "uuid_column", "uuid") modparam("avpops", "username_column", "username") modparam("avpops", "domain_column", "domain") modparam("avpops", "attribute_column", "attribute") modparam("avpops", "value_column", "value") modparam("avpops", "type_column", "type")
modparam("lcr", "db_url", "mysql://root:password@192.168.8.35/ser") modparam("lcr", "gw_table", "gw") modparam("lcr", "gw_name_column", "gw_name") modparam("lcr", "ip_addr_column", "ip_addr") modparam("lcr", "port_column", "port") modparam("lcr", "uri_scheme_column", "uri_scheme") modparam("lcr", "transport_column", "transport") modparam("lcr", "grp_id_column", "grp_id") modparam("lcr", "lcr_table", "lcr") modparam("lcr", "prefix_column", "prefix") modparam("lcr", "from_uri_column", "from_uri") modparam("lcr", "priority_column", "priority") modparam("lcr", "gw_uri_avp", "1400") modparam("lcr", "contact_avp", "1401") modparam("lcr", "fr_inv_timer_avp", "fr_inv_timer_avp") modparam("lcr", "fr_inv_timer", 30) modparam("lcr", "fr_inv_timer_next", 30) modparam("lcr", "rpid_avp", "rpid")
modparam("rr", "enable_full_lr", 1) modparam("rr", "append_fromtag", 1) modparam("rr", "enable_double_rr", 1) modparam("rr", "add_username", 0)
modparam("tm", "fr_timer", 10) modparam("tm", "fr_inv_timer", 30) modparam("tm", "wt_timer", 10) modparam("tm", "delete_timer", 2) modparam("tm", "retr_timer1p1", 1) modparam("tm", "retr_timer1p2", 2) modparam("tm", "retr_timer1p3", 4) modparam("tm", "retr_timer2", 4) modparam("tm", "noisy_ctimer", 0) modparam("tm", "via1_matching", 1) modparam("tm", "unix_tx_timeout", 2) modparam("tm", "restart_fr_on_each_reply", 1) modparam("tm", "fr_timer_avp", "callee_fr_timer") modparam("tm", "fr_inv_timer_avp", "callee_fr_inv_timer") modparam("tm", "tw_append", "")
modparam("acc", "db_url", "mysql://root:password@192.168.8.35/ser") modparam("acc", "radius_config", "/etc/ser/radius/radiusclient.conf") modparam("acc", "log_fmt", "cdfimorstup") modparam("acc", "log_level", 1) modparam("acc", "service_type", 15) modparam("acc", "log_flag", 21) modparam("acc", "log_missed_flag", 22) modparam("acc", "db_flag", 23) modparam("acc", "db_missed_flag", 24) modparam("acc", "radius_flag", 25) modparam("acc", "radius_missed_flag", 26) modparam("acc", "report_ack", 0) modparam("acc", "report_cancels", 1) modparam("acc", "failed_transactions", 1) modparam("acc", "early_media", 0)
modparam("nathelper", "rtpproxy_sock", "unix:/var/run/rtpproxy.sock") modparam("nathelper", "rtpproxy_disable", 1) modparam("nathelper", "natping_interval", 0) modparam("nathelper", "ping_nated_only", 1) modparam("nathelper", "received_avp", 42) modparam("nathelper", "rtpproxy_disable_tout", 60) modparam("nathelper", "rtpproxy_tout", 1) modparam("nathelper", "rtpproxy_retr", 5) modparam("nathelper", "force_socket", "")
modparam("mediaproxy", "mediaproxy_socket", "/var/run/mediaproxy.sock") modparam("mediaproxy", "sip_asymmetrics", "/etc/ser/mediaproxy/sip") modparam("mediaproxy", "rtp_asymmetrics", "/etc/ser/mediaproxy/rtp") modparam("mediaproxy", "natping_interval", 30)
modparam("exec", "setvars", 1)
modparam("speeddial", "db_url", "mysql://root:password@192.168.8.35/ser") modparam("speeddial", "use_domain", 0) modparam("speeddial", "user_column", "username") modparam("speeddial", "domain_column", "domain") modparam("speeddial", "sd_user_column", "sd_username") modparam("speeddial", "sd_domain_column", "sd_domain") modparam("speeddial", "new_uri_column", "new_uri") modparam("speeddial", "domain_prefix", "sip.")
modparam("maxfwd", "max_limit", 16)
modparam("options", "accept", "*/*") modparam("options", "accept_encoding", "") modparam("options", "accept_language", "en")
modparam("xlog", "buf_size", 8192)
modparam("uac", "from_store_param", "vsf") modparam("uac", "credential", "username:domain:password")
modparam("msilo", "db_url", "mysql://root:password@192.168.8.35/ser") modparam("msilo", "db_table", "silo") modparam("msilo", "registrar", "sip:registrar@tristarcorp.net") modparam("msilo", "expire_time", 259200) modparam("msilo", "check_time", 30) modparam("msilo", "use_contact", 1)
modparam("avp_radius", "radius_config", "/etc/ser/radius/radiusclient.conf") modparam("avp_radius", "caller_service_type", 15) modparam("avp_radius", "callee_service_type", 15)
# ----------------------------------------------------------------- # Main Route # -----------------------------------------------------------------
route {
# ----------------------------------------------------------------- # Sanity Check # -----------------------------------------------------------------
if (!mf_process_maxfwd_header("10")) {
if (method != "ACK") {
sl_send_reply("483", "Too Many Hops");
};
break;
};
if (msg:len > max_len) {
if (method != "ACK") {
sl_send_reply("513", "Message Overflow");
};
break;
};
# ----------------------------------------------------------------- # Record Route # -----------------------------------------------------------------
if (method == "INVITE" && client_nat_test("3")) {
record_route_preset("192.168.8.35:5060;nat=yes");
} else if (method != "REGISTER") {
record_route();
};
# ----------------------------------------------------------------- # Call Tear Down # -----------------------------------------------------------------
if (method == "BYE" || method == "CANCEL") {
end_media_session();
};
# ----------------------------------------------------------------- # Loose Routing # -----------------------------------------------------------------
if (loose_route()) {
if (has_totag() && (method == "INVITE" || method == "ACK")) {
if (client_nat_test("3") || search("^Route:.*;nat=yes")) {
setflag(6); use_media_proxy();
};
};
route(1); break;
};
# ----------------------------------------------------------------- # Call Processing # -----------------------------------------------------------------
if (uri != myself) {
route(1); break;
};
if (uri == myself) {
if (method == "REGISTER") {
route(2); break;
} else if (method == "REFER" || method == "INVITE" || method == "CANCEL") {
route(3); break;
} else if (method == "OPTIONS") {
options_reply(); break;
};
lookup("aliases");
if (uri != myself) {
route(1); break;
};
if (!lookup("location")) {
sl_send_reply("404", "User Not Found"); break;
};
};
route(1); break;
}
# ----------------------------------------------------------------- # Default Message Handler # -----------------------------------------------------------------
route[1] {
# ----------------------------------------------------------------- # Reply Routing # -----------------------------------------------------------------
t_on_reply("1");
# ----------------------------------------------------------------- # Call Log & Accounting (log=21, sql=23, radius=25) # -----------------------------------------------------------------
setflag(23);
# ----------------------------------------------------------------- # Relay Call # -----------------------------------------------------------------
if (!t_relay()) {
if (method == "INVITE" || method == "ACK") {
end_media_session();
};
if (method != "REFER" && method != "INVITE" && method != "CANCEL" && method != "ACK") {
sl_reply_error();
};
};
}
# ----------------------------------------------------------------- # Register Message Handler # -----------------------------------------------------------------
route[2] {
# ----------------------------------------------------------------- # Nat Test # -----------------------------------------------------------------
if (!search("^Contact:\ +*") && client_nat_test("7")) {
setflag(6); fix_nated_register(); force_rport();
};
# ----------------------------------------------------------------- # Authenticate User # -----------------------------------------------------------------
if (!allow_trusted() && !from_gw()) {
if (!www_authorize("", "subscriber")) {
www_challenge("", "1"); break;
};
consume_credentials();
};
# ----------------------------------------------------------------- # Save Registration # -----------------------------------------------------------------
if (!save("location")) {
sl_reply_error();
};
}
# ----------------------------------------------------------------- # Invite/Cancel Message Handler # -----------------------------------------------------------------
route[3] {
# ----------------------------------------------------------------- # Nat Fixup # -----------------------------------------------------------------
if (client_nat_test("3")) {
setflag(7); force_rport(); fix_nated_contact();
};
# ----------------------------------------------------------------- # Authorize Users / Setup Voicemail For Gateways # -----------------------------------------------------------------
if (!allow_trusted() || !from_gw()) {
if (!proxy_authorize("", "subscriber")) {
proxy_challenge("", "1"); break;
};
consume_credentials();
};
# ----------------------------------------------------------------- # Check For Alias # -----------------------------------------------------------------
lookup("aliases");
if (uri != myself) {
route(4); break;
};
# ----------------------------------------------------------------- # Cancel Call # -----------------------------------------------------------------
if (method == "CANCEL") {
route(1); break;
};
# ----------------------------------------------------------------- # Check For Local User # -----------------------------------------------------------------
lookup("location");
if (uri != myself) {
route(4); break;
};
# ----------------------------------------------------------------- # Route Call # -----------------------------------------------------------------
if (uri =~ "^sip:1[0-9]{10}@" || uri =~ "^sip:011") {
route(5); break;
} else {
sl_send_reply("404", "User Not Found"); break;
};
}
# ----------------------------------------------------------------- # Media Proxy Enabler # -----------------------------------------------------------------
route[4] {
# ----------------------------------------------------------------- # Enable Media Proxy # -----------------------------------------------------------------
if (isflagset(6) || isflagset(7)) {
use_media_proxy();
};
route(1); break;
}
# ----------------------------------------------------------------- # Gateway LCR Route Handler # -----------------------------------------------------------------
route[5] {
# ----------------------------------------------------------------- # Load Pstn LCR Gateways # -----------------------------------------------------------------
if (!load_gws()) {
sl_send_reply("500", "Internal Server Error, No PSTN Gateways"); break;
};
# ----------------------------------------------------------------- # Find Next Available Gateway # -----------------------------------------------------------------
if (!next_gw()) {
sl_send_reply("503", "Service Temporarilly Unavailable"); break;
}
# ----------------------------------------------------------------- # Route Call # -----------------------------------------------------------------
t_on_failure("1"); route(4); break;
}
# ----------------------------------------------------------------- # LCR Route Failure Handler # -----------------------------------------------------------------
failure_route[1] {
# ----------------------------------------------------------------- # Failed Call Log & Accounting (log=22, sql=24, radius=26) # -----------------------------------------------------------------
setflag(24);
# ----------------------------------------------------------------- # Find Next Available Gateway # -----------------------------------------------------------------
if (method == "INVITE" && t_check_status("404|408|500|503")) {
if (!next_gw()) {
t_reply("503", "Service Temporarilly Unavailable, No More Available Gateways"); break;
};
t_on_failure("1"); route(4); break;
};
}
# ----------------------------------------------------------------- # Reply Route # -----------------------------------------------------------------
onreply_route[1] {
# ----------------------------------------------------------------- # Enable Media Proxy # -----------------------------------------------------------------
if ((isflagset(6) || isflagset(7)) && (status =~ "(180)|(183)|2[0-9][0-9]")) {
if (!search("^Content-Length:\ +0")) {
use_media_proxy();
};
};
# ----------------------------------------------------------------- # Nat Fixup # -----------------------------------------------------------------
if (client_nat_test("1")) {
fix_nated_contact();
};
}
Thank You
Anthony Dean
This correspondence is considered confidential and any reproduction for the purpose of public disclosure is forbidden without written permission by the author signed above. If you are not the intended recipient, please immediately notify the sender and delete any copies.
If you are responding to this e-mail, please append or attach all previous correspondence as a point of reference.
Anthony Dean wrote:
The bug is in the "c=IN IPV4" line in the invite to the second gateway where there should only be one ip address. So it sends the following:
c=IN IPV4 192.168.8.35192.168.8.35.
I had the same problem when accidently calling use_media_proxy() twice, IIRC. Maybe you should check that...
Andy
Good call, that fixed the issue. It was calling use_media_proxy twice that messed up the packet (once during the invite for the first gateway and again for the second).
Thank You
Anthony Dean
This correspondence is considered confidential and any reproduction for the purpose of public disclosure is forbidden without written permission by the author signed above. If you are not the intended recipient, please immediately notify the sender and delete any copies.
If you are responding to this e-mail, please append or attach all previous correspondence as a point of reference.
-----Original Message----- From: Andreas Granig [mailto:andreas.granig@inode.info] Sent: Friday, September 09, 2005 1:45 PM To: Anthony Dean Cc: serusers@lists.iptel.org Subject: Re: [Serusers] Issues when using LCR module
Anthony Dean wrote:
The bug is in the "c=IN IPV4" line in the invite to the second gateway where there should only be one ip address. So it sends the following:
c=IN IPV4 192.168.8.35192.168.8.35.
I had the same problem when accidently calling use_media_proxy() twice, IIRC. Maybe you should check that...
Andy