How to Forward Calls to Voicemail when Busy or Unavailable
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_voicemail
Limitations
Forwarding to voicemail can be done to the default voicemail service, or a custom service.
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"},
"default": {}
}' \
sandbox.api.shamrock.wgtwo.com:443 \
wgtwo.callforward.v0.CallForwardingService/SetToVoicemail
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