[sr-dev] git:master: modules_k/outbound: updated documentation
Peter Dunkley
peter.dunkley at crocodile-rcs.com
Tue Jan 8 12:27:51 CET 2013
Module: sip-router
Branch: master
Commit: 82303dfad79c601767bb8e1a115fd30d1fb3a282
URL: http://git.sip-router.org/cgi-bin/gitweb.cgi/sip-router/?a=commit;h=82303dfad79c601767bb8e1a115fd30d1fb3a282
Author: Peter Dunkley <peter.dunkley at crocodile-rcs.com>
Committer: Peter Dunkley <peter.dunkley at crocodile-rcs.com>
Date: Tue Jan 8 11:27:11 2013 +0000
modules_k/outbound: updated documentation
- Fixed some mistakes in the Edge Proxy example
- Filled in more detail in the Registrar example
---
modules_k/outbound/README | 62 +++++++++++++++++++++++++++-
modules_k/outbound/doc/outbound_admin.xml | 62 +++++++++++++++++++++++++++-
2 files changed, 118 insertions(+), 6 deletions(-)
diff --git a/modules_k/outbound/README b/modules_k/outbound/README
index ff5c195..af8fb1f 100644
--- a/modules_k/outbound/README
+++ b/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
diff --git a/modules_k/outbound/doc/outbound_admin.xml b/modules_k/outbound/doc/outbound_admin.xml
index 8f0b057..28c91d0 100644
--- a/modules_k/outbound/doc/outbound_admin.xml
+++ b/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>
More information about the sr-dev
mailing list