Copy
grpcurl \
-d '{
"subscriber": { "e164": "+4672xxxxxxx"},
"conditional": {
"busy": { "e164": "+4672xxxxxxx"},
"unavailable": { "e164": "+4672xxxxxxx"}
}
}' \
sandbox.api.shamrock.wgtwo.com:443 \
wgtwo.callforward.v0.CallForwardingService/SetToNumber
Copy
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.NumberCallForwardingRequest.newBuilder()) {
this.subscriber = with(PhoneNumberProto.PhoneNumber.newBuilder()) {
this.e164 = "+4672xxxxxxx"
build()
}
this.conditional = with(CallForwardingProto.Conditional.newBuilder()) {
this.busy = with(PhoneNumberProto.PhoneNumber.newBuilder()) {
this.e164 = "+4672xxxxxxx"
build()
}
this.unavailable = with(PhoneNumberProto.PhoneNumber.newBuilder()) {
this.e164 = "+4672xxxxxxx"
build()
}
build()
}
build()
}
val result = stub.setToNumber(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(),
)
}
}