Quellcode durchsuchen

modules_k/outbound: updated documentation

- Fixed some mistakes in the Edge Proxy example
- Filled in more detail in the Registrar example
Peter Dunkley vor 12 Jahren
Ursprung
Commit
82303dfad7
2 geänderte Dateien mit 118 neuen und 6 gelöschten Zeilen
  1. 59 3
      modules_k/outbound/README
  2. 59 3
      modules_k/outbound/doc/outbound_admin.xml

+ 59 - 3
modules_k/outbound/README

@@ -140,6 +140,8 @@ route {
                                 # must be outbound routed
                         }
                 }
+
+                t_on_failure("FAIL_OUTBOUND");
                 route(RELAY);
         } else if (is_method("REGISTER")) {
                 add_path();
@@ -151,7 +153,6 @@ route {
 }
 
 route[RELAY] {
-        t_on_failure("FAIL_OUTBOUND");
         if (!t_relay()) {
                 sl_send_reply("430", "Flow Failed");
         }
@@ -193,20 +194,75 @@ onreply_route {
                 if ($(hdr(Require)[*])=~"outbound")
                         insert_hf("Flow-Timer: FLOW_TIMER\r\n", "Call-ID");
         }
+
+...
 }
 
-failure_route[REPLY_OUTBOUND] {
+failure_route[FAIL_OUTBOUND] {
         if (t_branch_timeout() || !t_branch_replied()) {
                 send_reply("430", "Flow Failed");
         }
 }
+...
 
    Example 1.3. Registrar Configuration
 ...
+loadmodule "tm.so"
+...
 loadmodule "registrar.so"
 ...
+modparam("tm", "contacts_avp", "tm_contacts")
+modparam("tm", "contact_flows_avp", "tm_contact_flows")
+...
+modparam("registrar", "use_path", 1)
+modparam("registrar", "path_mode", 2)
 modparam("registrar", "outbound_mode", 2)
-### TBD
+...
+route[LOCATION] {
+...
+        if (!lookup("location")) {
+                $var(rc) = $rc;
+                route(TOVOICEMAIL);
+                t_newtran();
+                switch ($var(rc)) {
+                        case -1:
+                        case -3:
+                                send_reply("404", "Not Found");
+                                exit;
+                        case -2:
+                                send_reply("405", "Method Not Allowed");
+                                exit;
+                }
+        }
+
+        if (!t_load_contacts()) {
+                send_reply("500", "Server Internal Error");
+                exit;
+        }
+
+        if (!t_next_contacts()) {
+                send_reply("500", "Server Internal Error");
+                exit;
+        }
+
+        t_on_failure(FAIL_OUTBOUND);
+...
+}
+...
+failure_route[FAIL_OUTBOUND] {
+        if (t_check_status("408|430")) {
+                if (!t_next_contact_flows() && !t_next_contacts()) {
+                        send_reply("500", "Server Internal Error");
+                        exit;
+                }
+        } else if (!t_next_contacts()) {
+                send_reply("500", "Server Internal Error");
+                exit;
+        }
+
+        t_on_failure(FAIL_OUTBOUND);
+        route[RELAY];
+}
 ...
 
 2. Dependencies

+ 59 - 3
modules_k/outbound/doc/outbound_admin.xml

@@ -95,6 +95,8 @@ route {
 				# must be outbound routed
 			}
 		}
+
+		t_on_failure("FAIL_OUTBOUND");
 		route(RELAY);
 	} else if (is_method("REGISTER")) {
 		add_path();
@@ -106,7 +108,6 @@ route {
 }
 
 route[RELAY] {
-	t_on_failure("FAIL_OUTBOUND");
 	if (!t_relay()) {
 		sl_send_reply("430", "Flow Failed");
 	}
@@ -148,23 +149,78 @@ onreply_route {
 		if ($(hdr(Require)[*])=~"outbound")
 			insert_hf("Flow-Timer: FLOW_TIMER\r\n", "Call-ID");
 	}
+
+...
 }
 
-failure_route[REPLY_OUTBOUND] {
+failure_route[FAIL_OUTBOUND] {
 	if (t_branch_timeout() || !t_branch_replied()) {
 		send_reply("430", "Flow Failed");
 	}
 }
+...
 ]]></programlisting>
 	</example>
 	<example>
 	<title>Registrar Configuration</title>
 	<programlisting><![CDATA[
 ...
+loadmodule "tm.so"
+...
 loadmodule "registrar.so"
 ...
+modparam("tm", "contacts_avp", "tm_contacts")
+modparam("tm", "contact_flows_avp", "tm_contact_flows")
+...
+modparam("registrar", "use_path", 1)
+modparam("registrar", "path_mode", 2)
 modparam("registrar", "outbound_mode", 2)
-### TBD
+...
+route[LOCATION] {
+...
+	if (!lookup("location")) {
+		$var(rc) = $rc;
+		route(TOVOICEMAIL);
+		t_newtran();
+		switch ($var(rc)) {
+			case -1:
+			case -3:
+				send_reply("404", "Not Found");
+				exit;
+			case -2:
+				send_reply("405", "Method Not Allowed");
+				exit;
+		}
+	}
+
+	if (!t_load_contacts()) {
+		send_reply("500", "Server Internal Error");
+		exit;
+	}
+
+	if (!t_next_contacts()) {
+		send_reply("500", "Server Internal Error");
+		exit;
+	}
+
+	t_on_failure(FAIL_OUTBOUND);
+...
+}
+...
+failure_route[FAIL_OUTBOUND] {
+	if (t_check_status("408|430")) {
+		if (!t_next_contact_flows() && !t_next_contacts()) {
+			send_reply("500", "Server Internal Error");
+			exit;
+		}
+	} else if (!t_next_contacts()) {
+		send_reply("500", "Server Internal Error");
+		exit;
+	}
+
+	t_on_failure(FAIL_OUTBOUND);
+	route[RELAY];
+}
 ...
 ]]></programlisting>
 	</example>