Skip to content

Commit

Permalink
extract transferStatus in variable
Browse files Browse the repository at this point in the history
  • Loading branch information
e.eschenko committed Feb 20, 2023
1 parent cc7f25c commit 1ef1117
Showing 1 changed file with 28 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,14 @@ interface TelephonyBotRequest : JaicpNativeBotRequest {
?.jsonObject?.get("schedule")?.jsonObject?.get("dialSchedule")?.jsonObject
?.let(JSON::decodeFromJsonElement)

/**
* Returns an object with data about the transfer status of a customer to an operator.
*
* @see [TransferStatus]
*/
val transferStatus: TransferStatus?
get() = jaicp.rawRequest.jsonObject["transferStatus"]?.let(JSON::decodeFromJsonElement)

/**
* Returns a token for downloading call recordings made in the current project.
* The Record calls toggle in the phone channel settings must be set to active so that call recordings become available for download.
Expand Down Expand Up @@ -111,6 +119,26 @@ interface TelephonyBotRequest : JaicpNativeBotRequest {
}
}

/**
* Contains the status of the transfer of a customer to an operator.
*
* @property status agent transfer status. It returns a string: `SUCCESS` or `FAIL`.
*
* @property hangup true means the customer has ended the conversation.
* false means the customer is still online and was re-directed to the bot (if continueCall: true in [TelephonySwitchReply]).
*
* @property number the phone number the call was transferred to.
*/

@Serializable
data class TransferStatus(
val status: String,
val hangup: Boolean,
val number: String
) {
val isSuccess = status == "SUCCESS"
}

@Serializable
data class Schedule(
val allowedDays: List<String>? = null,
Expand Down

0 comments on commit 1ef1117

Please sign in to comment.