Class SipRoutingClient
java.lang.Object
com.azure.communication.phonenumbers.siprouting.SipRoutingClient
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 Summary
Modifier and TypeMethodDescriptionvoiddeleteTrunk(String fqdn) Deletes SIP Trunk.com.azure.core.http.rest.Response<Void>deleteTrunkWithResponse(String fqdn, com.azure.core.util.Context context) Deletes SIP Trunk.Gets SIP Trunk by FQDN.com.azure.core.http.rest.Response<SipTrunk>getTrunkWithResponse(String fqdn, com.azure.core.util.Context context) Gets SIP Trunk by FQDN.com.azure.core.http.rest.PagedIterable<SipTrunkRoute>Lists SIP Trunk Routes.com.azure.core.http.rest.PagedIterable<SipTrunk>Lists SIP Trunks.voidsetRoutes(List<SipTrunkRoute> routes) Sets SIP Trunk Routes.com.azure.core.http.rest.Response<Void>setRoutesWithResponse(List<SipTrunkRoute> routes, com.azure.core.util.Context context) Sets SIP Trunk Routes.voidSets SIP Trunk.voidSets SIP Trunks.com.azure.core.http.rest.Response<Void>setTrunksWithResponse(List<SipTrunk> trunks, com.azure.core.util.Context context) Sets SIP Trunks.
-
Method Details
-
getTrunk
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
Lists SIP Trunks.Code Samples
PagedIterable<SipTrunk> trunks = sipRoutingClient.listTrunks(); for (SipTrunk trunk : trunks) { System.out.println("Trunk " + trunk.getFqdn() + ":" + trunk.getSipSignalingPort()); }- Returns:
- SIP Trunks.
-
listRoutes
Lists SIP Trunk Routes.Code Samples
PagedIterable<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.
-
setTrunk
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
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
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
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.
-