How to Forward All Calls Unconditionally to a Trunk
Warning: Beta software This API is in beta stage and may be subject to change. Therefore, we do not recommend using this in production.
Interested in this feature? Please reach out to mobility-services-developer@cisco.com
Prerequisites
Required Scope
callforwarding.to_number
Limitations
- Forwarding to trunk is only available if you have a trunk set up for you. Please get in touch with mobility-services-developer@cisco.com if you want to discuss this option.
Code Dependencies
<dependency>
<groupId>com.wgtwo.api.v0.grpc</groupId>
<artifactId>callforward</artifactId>
<version>0.3.0</version>
</dependency>
Code
#!/usr/bin/env bash
grpcurl \
-d '{
"subscriber": { "e164": "+4672xxxxxxx"},
"unconditional_trunk_forwarding": {
"forward_to_trunk": { "id": "xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx"}
}
}' \
sandbox.api.shamrock.wgtwo.com:443 \
wgtwo.callforward.v0.CallForwardingService/SetToTrunk
package com.example.callforwarding
import com.wgtwo.api.v0.callforward.CallForwardingProto
import com.wgtwo.api.v0.callforward.CallForwardingServiceGrpc
import com.wgtwo.api.v0.common.PhoneNumberProto
import io.grpc.ManagedChannelBuilder
fun main() {
val channel = ManagedChannelBuilder.forAddress("sandbox.api.shamrock.wgtwo.com", 443).build()
val stub = CallForwardingServiceGrpc.newBlockingStub(channel)
val message = with(CallForwardingProto.TrunkCallForwardingRequest.newBuilder()) {
this.subscriber = with(PhoneNumberProto.PhoneNumber.newBuilder()) {
this.e164 = "+4672xxxxxxx"
build()
}
this.unconditionalTrunkForwarding = with(CallForwardingProto.UnconditionalTrunkForwarding.newBuilder()) {
this.forwardToTrunk = with(CallForwardingProto.Trunk.newBuilder()) {
this.id = "xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx"
build()
}
build()
}
build()
}
val result = stub.setToTrunk(message)
if (result.status == CallForwardingProto.CallForwardingResponse.Status.ACCEPTED) {
println("Successfully set call forwarding")
println(result)
} else {
println(
"""
Failed to set call forwarding:
status=${result.status}
description=${result.errorMessage}"
""".trimIndent(),
)
}
}
Example Results
{
"status": "ACCEPTED"
}
Successfully set call forwarding
status: ACCEPTED