Class SipRoutingClient

java.lang.Object
com.azure.communication.phonenumbers.SipRoutingClient

public final class SipRoutingClient extends Object
Synchronous SIP Routing Client. This client contains all the operations for SipTrunk and SipTrunkRoute.

Instantiating a synchronous SIP Routing Client using connection string

 SipRoutingClient sipRoutingClient = new SipRoutingClientBuilder()
     .connectionString(connectionString)
     .buildClient();
 
See Also:
  • Method Details

    • getTrunk

      public SipTrunk getTrunk(String fqdn)
      Gets SIP Trunk by FQDN.

      Code Samples

       SipTrunk trunk = sipRoutingClient.getTrunk("<trunk fqdn>");
       System.out.println("Trunk " + trunk.getFqdn() + ":" + trunk.getSipSignalingPort());
       
      Parameters:
      fqdn - SIP Trunk FQDN.
      Returns:
      SIP Trunk if exists, null otherwise.
    • getTrunkWithResponse

      public com.azure.core.http.rest.Response<SipTrunk> getTrunkWithResponse(String fqdn, com.azure.core.util.Context context)
      Gets SIP Trunk by FQDN.

      Code Samples

       Response<SipTrunk> response = sipRoutingClient.getTrunkWithResponse("<trunk fqdn>", Context.NONE);
       SipTrunk trunk = response.getValue();
       System.out.println("Trunk " + trunk.getFqdn() + ":" + trunk.getSipSignalingPort());
       
      Parameters:
      fqdn - SIP Trunk FQDN.
      context - the context of the request. Can also be null or Context.NONE.
      Returns:
      Response object with the SIP Trunk if exists, with null otherwise.
    • listTrunks

      public List<SipTrunk> listTrunks()
      Lists SIP Trunks.

      Code Samples

       List<SipTrunk> trunks = sipRoutingClient.listTrunks();
       for (SipTrunk trunk : trunks) {
           System.out.println("Trunk " + trunk.getFqdn() + ":" + trunk.getSipSignalingPort());
       }
       
      Returns:
      SIP Trunks.
    • listTrunksWithResponse

      public com.azure.core.http.rest.Response<List<SipTrunk>> listTrunksWithResponse(com.azure.core.util.Context context)
      Lists SIP Trunks.

      Code Samples

       Response<List<SipTrunk>> response = sipRoutingClient.listTrunksWithResponse(Context.NONE);
       List<SipTrunk> trunks = response.getValue();
       for (SipTrunk trunk : trunks) {
           System.out.println("Trunk " + trunk.getFqdn() + ":" + trunk.getSipSignalingPort());
       }
       
      Parameters:
      context - the context of the request. Can also be null or Context.NONE.
      Returns:
      Response object with the SIP Trunks.
    • listRoutes

      public List<SipTrunkRoute> listRoutes()
      Lists SIP Trunk Routes.

      Code Samples

       List<SipTrunkRoute> routes = sipRoutingClient.listRoutes();
       for (SipTrunkRoute route : routes) {
           System.out.println("Route name: " + route.getName());
           System.out.println("Route description: " + route.getDescription());
           System.out.println("Route number pattern: " + route.getNumberPattern());
           System.out.println("Route trunks: " + String.join(",", route.getTrunks()));
       }
       
      Returns:
      SIP Trunk Routes.
    • listRoutesWithResponse

      public com.azure.core.http.rest.Response<List<SipTrunkRoute>> listRoutesWithResponse(com.azure.core.util.Context context)
      Lists SIP Trunk Routes.

      Code Samples

       Response<List<SipTrunkRoute>> response = sipRoutingClient.listRoutesWithResponse(Context.NONE);
       List<SipTrunkRoute> routes = response.getValue();
       for (SipTrunkRoute route : routes) {
           System.out.println("Route name: " + route.getName());
           System.out.println("Route description: " + route.getDescription());
           System.out.println("Route number pattern: " + route.getNumberPattern());
           System.out.println("Route trunks: " + String.join(",", route.getTrunks()));
       }
       
      Parameters:
      context - the context of the request. Can also be null or Context.NONE.
      Returns:
      Response object with the SIP Trunk Routes.
    • setTrunk

      public void setTrunk(SipTrunk trunk)
      Sets SIP Trunk. If a trunk with specified FQDN already exists, it will be replaced, otherwise a new trunk will be added.

      Code Samples

       sipRoutingClient.setTrunk(new SipTrunk("<trunk fqdn>", 12345));
       
      Parameters:
      trunk - SIP Trunk.
    • setTrunks

      public void setTrunks(List<SipTrunk> trunks)
      Sets SIP Trunks.

      Code Samples

       sipRoutingClient.setTrunks(asList(
           new SipTrunk("<first trunk fqdn>", 12345),
           new SipTrunk("<second trunk fqdn>", 23456)
       ));
       
      Parameters:
      trunks - SIP Trunks.
    • setTrunksWithResponse

      public com.azure.core.http.rest.Response<Void> setTrunksWithResponse(List<SipTrunk> trunks, com.azure.core.util.Context context)
      Sets SIP Trunks.

      Code Samples

       Response<Void> response = sipRoutingClient.setTrunksWithResponse(asList(
           new SipTrunk("<first trunk fqdn>", 12345),
           new SipTrunk("<second trunk fqdn>", 23456)
       ), Context.NONE);
       
      Parameters:
      trunks - SIP Trunks.
      context - the context of the request. Can also be null or Context.NONE.
      Returns:
      Response object.
    • setRoutes

      public void setRoutes(List<SipTrunkRoute> routes)
      Sets SIP Trunk Routes.

      Code Samples

       sipRoutingClient.setRoutes(asList(
           new SipTrunkRoute("route name1", ".*9").setTrunks(asList("<first trunk fqdn>", "<second trunk fqdn>")),
           new SipTrunkRoute("route name2", ".*").setTrunks(asList("<second trunk fqdn>"))
       ));
       
      Parameters:
      routes - SIP Trunk Routes.
    • setRoutesWithResponse

      public com.azure.core.http.rest.Response<Void> setRoutesWithResponse(List<SipTrunkRoute> routes, com.azure.core.util.Context context)
      Sets SIP Trunk Routes.

      Code Samples

       Response<Void> response = sipRoutingClient.setRoutesWithResponse(asList(
           new SipTrunkRoute("route name1", ".*9").setTrunks(asList("<first trunk fqdn>", "<second trunk fqdn>")),
           new SipTrunkRoute("route name2", ".*").setTrunks(asList("<second trunk fqdn>"))
       ), Context.NONE);
       
      Parameters:
      routes - SIP Trunk Routes.
      context - the context of the request. Can also be null or Context.NONE.
      Returns:
      Response object.
    • deleteTrunk

      public void deleteTrunk(String fqdn)
      Deletes SIP Trunk.

      Code Samples

       sipRoutingClient.deleteTrunk("<trunk fqdn>");
       
      Parameters:
      fqdn - SIP Trunk FQDN.
    • deleteTrunkWithResponse

      public com.azure.core.http.rest.Response<Void> deleteTrunkWithResponse(String fqdn, com.azure.core.util.Context context)
      Deletes SIP Trunk.

      Code Samples

       Response<Void> response = sipRoutingClient.deleteTrunkWithResponse("<trunk fqdn>", Context.NONE);
       
      Parameters:
      fqdn - SIP Trunk FQDN.
      context - the context of the request. Can also be null or Context.NONE.
      Returns:
      Response object.