How to Forward Calls to Another Number 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

  1. An OAuth 2.0 client
  2. A client access token

Required Scope

  • callforwarding.to_number

Limitations

  • Call forwarding is not available to special/premium/international numbers.

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"},
        "conditional": {
          "busy": { "e164": "+4672xxxxxxx"},
          "unavailable": { "e164": "+4672xxxxxxx"}
        }
      }' \
  sandbox.api.shamrock.wgtwo.com:443 \
  wgtwo.callforward.v0.CallForwardingService/SetToNumber

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(),
        )
    }
}

Example Results

{
  "status": "ACCEPTED"
}
Successfully set call forwarding
status: ACCEPTED

Read More