[OpenSIPS-Users] dispatcher and attended transfers

Stanisław Pitucha viraptor at gmail.com
Fri Apr 24 13:00:19 CEST 2009


2009/4/15 Bogdan-Andrei Iancu <bogdan at voice-system.ro>:
> Right now the function is not allowed in failure route, but on a short
> overview on the code, there is no reason not to. So, as a trick you can call
> from failure route a generic route block and use the ds_selectxxX() from
> there - this will by pass the checks ;).

Great - finally got time to test that and it works.

The basic idea is (with some pseudocode and fake queries ;) ):

route[5] {
  avp_db_query("select callee_contact from dialog [table to check if
there are any other dialogs from the same number with state in (3,4)
and timeout > unix_timestamp() and lots of other conditions on
from_uri and to_uri]", "$avp(s:othercalldest)");
  if (is_avp_set("$avp(s:othercalldest)") {
    $var(commonuri) = $(avp(s:othercalldest)[0]);
    $var(commonhost) = $(var(commonuri){uri.host});
    if (is_one_of_our_pbxes($var(commonhost)) {
      t_on_failure("2");
      $rd = $var(commonhost);
      return;
    } else {
      # same check for $(avp(s:othercalldest)[1])
    }
  } else {
    route(6);
  }
}

route[6] {
  t_on_failure("1");
  ds_select_domain(...);
}

failure_route[1] {
  # standard check status, ds_next_domain(...) and t_relay()
}

failure_route[2] {
  if (t_check_status("408|480|5[0-9][0-9]")) {
    route(6);
    t_relay();
  }
}



More information about the Users mailing list