How to Forward All Calls Unconditionally to Another Number

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"},
        "unconditional": {
          "forward_to_number": { "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.unconditional = with(CallForwardingProto.Unconditional.newBuilder()) {
            this.forwardToNumber = 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