Module: sip-router
Branch: pd/outbound
Commit: 9f636841675f9cdd5a4baf768784564be71660b0
URL:    
http://git.sip-router.org/cgi-bin/gitweb.cgi/sip-router/?a=commit;h=9f636841675f9cdd5a4baf768784564be71660b0

Author: Peter Dunkley <[email protected]>
Committer: Peter Dunkley <[email protected]>
Date:   Sun Jan  6 19:32:45 2013 +0000

modules_k/outbound: Updates to outbound module documentation

---

 modules_k/outbound/README                 |   72 +++++++++++++++++++++++++++--
 modules_k/outbound/doc/outbound_admin.xml |   72 +++++++++++++++++++++++++++--
 2 files changed, 136 insertions(+), 8 deletions(-)

diff --git a/modules_k/outbound/README b/modules_k/outbound/README
index 8a98e0c..d1d920b 100644
--- a/modules_k/outbound/README
+++ b/modules_k/outbound/README
@@ -117,12 +117,70 @@ modparam("websocket", "keepalive_timeout", FLOW_TIMER+5)
 modparam("outbound", "flow_token_key", "!!!Kamailio rocks!!!")
 ...
 route {
-...
-        if (is_method("INVITE|SUBSCRIBE"))
+        route(REQINIT);
+        ...
+        t_check_trans();
+
+        if (is_method("INVITE|SUBSCRIBE")) {
                 record_route();
-        else if (is_method("REGISTER"))
+
+                if ($rU==$null) {
+                        sl_send_reply("484", "Address Incomplete");
+                        exit;
+                }
+
+                if (!loose_route()) {
+                        switch($rc) {
+                        case -2:
+                                # Flow-token has been tampered with
+                                sl_send_reply("403", "Forbidden");
+                                exit;
+                        case -1:
+                                # Handle -1 here if all dialog forming requests
+                                # must be outbound routed
+                        }
+                }
+                route(RELAY);
+        } else if (is_method("REGISTER")) {
                 add_path();
+                if (!t_relay("### Registrar ###")) {
+                        sl_reply_error();
+                }
+                exit;
+        }
+}
+
+route[RELAY] {
+        t_on_failure("FAIL_OUTBOUND");
+        if (!t_relay()) {
+                sl_send_reply("430", "Flow Failed");
+        }
+        exit;
+}
 ...
+route[WITHINDLG] {
+        if (has_totag()) {
+                if (!loose_route()) {
+                        switch($rc) {
+                        case -2:
+                                sl_send_reply("403", "Forbidden");
+                                exit;
+                        case -1:
+                                if (is_method("ACK")) {
+                                        if (t_check_trans()) {
+                                                t_relay();
+                                                exit;
+                                        } else {
+                                                exit;
+                                        }
+                                }
+                                sl_send_reply("404", "Not Found");
+                        }
+                } else {
+                        route(RELAY);
+                }
+                exit;
+        }
 }
 ...
 onreply_route {
@@ -137,11 +195,17 @@ onreply_route {
         }
 }
 
+failure_route[REPLY_OUTBOUND] {
+        if (t_branch_timeout() || !t_branch_replied()) {
+                send_reply("430", "Flow Failed");
+        }
+}
+
    Example 1.3. Registrar Configuration
 ...
 loadmodule "registrar.so"
 ...
-modparam("registrar", "outbound_mode", 2)
+TBD
 ...
 
 2. Dependencies
diff --git a/modules_k/outbound/doc/outbound_admin.xml 
b/modules_k/outbound/doc/outbound_admin.xml
index 992c0c4..97e718d 100644
--- a/modules_k/outbound/doc/outbound_admin.xml
+++ b/modules_k/outbound/doc/outbound_admin.xml
@@ -72,12 +72,70 @@ modparam("websocket", "keepalive_timeout", FLOW_TIMER+5)
 modparam("outbound", "flow_token_key", "!!!Kamailio rocks!!!")
 ...
 route {
-...
-       if (is_method("INVITE|SUBSCRIBE"))
+       route(REQINIT);
+       ...
+       t_check_trans();
+
+       if (is_method("INVITE|SUBSCRIBE")) {
                record_route();
-       else if (is_method("REGISTER"))
+
+               if ($rU==$null) {
+                       sl_send_reply("484", "Address Incomplete");
+                       exit;
+               }
+
+               if (!loose_route()) {
+                       switch($rc) {
+                       case -2:
+                               # Flow-token has been tampered with
+                               sl_send_reply("403", "Forbidden");
+                               exit;
+                       case -1:
+                               # Handle -1 here if all dialog forming requests
+                               # must be outbound routed
+                       }
+               }
+               route(RELAY);
+       } else if (is_method("REGISTER")) {
                add_path();
+               if (!t_relay("### Registrar ###")) {
+                       sl_reply_error();
+               }
+               exit;
+       }
+}
+
+route[RELAY] {
+       t_on_failure("FAIL_OUTBOUND");
+       if (!t_relay()) {
+               sl_send_reply("430", "Flow Failed");
+       }
+       exit;
+}
 ...
+route[WITHINDLG] {
+       if (has_totag()) {
+               if (!loose_route()) {
+                       switch($rc) {
+                       case -2:
+                               sl_send_reply("403", "Forbidden");
+                               exit;
+                       case -1:
+                               if (is_method("ACK")) {
+                                       if (t_check_trans()) {
+                                               t_relay();
+                                               exit;
+                                       } else {
+                                               exit;
+                                       }
+                               }
+                               sl_send_reply("404", "Not Found");
+                       }
+               } else {
+                       route(RELAY);
+               }
+               exit;
+       }
 }
 ...
 onreply_route {
@@ -91,6 +149,12 @@ onreply_route {
                        insert_hf("Flow-Timer: FLOW_TIMER\r\n", "Call-ID");
        }
 }
+
+failure_route[REPLY_OUTBOUND] {
+       if (t_branch_timeout() || !t_branch_replied()) {
+               send_reply("430", "Flow Failed");
+       }
+}
 ]]></programlisting>
        </example>
        <example>
@@ -99,7 +163,7 @@ onreply_route {
 ...
 loadmodule "registrar.so"
 ...
-modparam("registrar", "outbound_mode", 2)
+TBD
 ...
 ]]></programlisting>
        </example>


_______________________________________________
sr-dev mailing list
[email protected]
http://lists.sip-router.org/cgi-bin/mailman/listinfo/sr-dev

Reply via email to