[OpenSIPS-Devel] [opensips] (discussion only) uri_resolve method build dest uri with SRV support (#483)

Jarrod Baumann notifications at github.com
Tue Apr 28 22:35:15 CEST 2015


This pull request is definitely not finished and probably not even the right direction so I did not want to spend a lot of time on it, but wanted to continue the discussion from previous PR #474.  This exposes do_srv_lookup from resolve.c poorly because of issue #482.

This PR is attempting to solve 2 issues per the discussion:
1) Build destination uri from a preferred protocol list that will fall-through until it finds a result.
2) Be able to identify the address family of the host based destination within the script for offering IP6 or IP4 SDP.

The first argument to the method will be populated with the phostport;protocol string as a result from the queries.

The second argument is a semi-colon separated list of protocols to try.  As the protocols are tried, they are removed from the list so that the remaining can be retried from a failure_route.  If not SRV records are found, it tries to simply resolve the A or AAAA record for the host.

Here is an rudimentary example of how I've been testing it:

```
branch_route[rtpengine] {
  $avp(plist) = "tls;tcp;udp";
  if (uri_resolve("$avp(du)", "$avp(plist)")) {
    $du = $avp(du); # set the $du to our result
    t_on_failure("1");

    if ($du =~ "^sip:[0-9]{1,3}\..*$") {
      $dlg_val(uas_ipv)="IP4";
    } else {
      $dlg_val(uas_ipv)="IP6";
    }
  }
  ...
}

failure_route[1] {
  if (!t_check_status("(5..)|(6..)|(403)")) {
    xlog("L_NOTICE","$var(request_log) $rs not acceptable failure\n");
    exit;
  }

  if ($avp(plist)) {
      # The first protocol failed, go to the next one.
      if (uri_resolve("$avp(du)", "$avp(plist)")) {
        t_on_failure("1");
        $du = $avp(du);
      }
  } else {
    exit;
  }
}

```


You can view, comment on, or merge this pull request online at:

  https://github.com/OpenSIPS/opensips/pull/483

-- Commit Summary --

  * (discussion only) uri_resolve method added that builds dest uri with support for SRV protocol record fall-through

-- File Changes --

    A modules/uri/methods.c (144)
    A modules/uri/methods.h (26)
    M modules/uri/uri_mod.c (36)
    M resolve.c (2)
    M resolve.h (3)

-- Patch Links --

https://github.com/OpenSIPS/opensips/pull/483.patch
https://github.com/OpenSIPS/opensips/pull/483.diff

---
Reply to this email directly or view it on GitHub:
https://github.com/OpenSIPS/opensips/pull/483
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.opensips.org/pipermail/devel/attachments/20150428/6e1612c5/attachment.htm>


More information about the Devel mailing list