Activeflow

Overview

The activeflow is a dynamic entity within the VoIPBIN system that plays a vital role in representing the real-time state of a registered flow. As the flow is executed, it generates an activeflow, which contains an action cursor and relevant status information. This activeflow serves as a control interface, providing efficient management and flexibility during flow execution.

In essence, the activeflow concept is a powerful tool that facilitates the smooth and flexible execution of registered flows. Its dynamic nature allows for real-time updates, ensuring that users can monitor and manage the flow execution efficiently.

By providing real-time status updates and a flexible control interface, the activeflow becomes a valuable tool for businesses to efficiently manage complex workflows and automate their critical processes. The stop functionality adds an extra layer of control and adaptability, allowing users to make informed decisions and optimize their flow executions as required.

Execution

The activeflow’s significance lies in its ability to manage complex workflows and automate business processes effectively. As the flow progresses through its various stages, the activeflow dynamically represents its current state. This representation provides valuable insights into the flow’s progress and status, enabling efficient and informed management of its execution.

_images/activeflow_overview_execution.png

Status and Control interface

The activeflow includes essential status information that allows users to monitor the flow’s progress closely. This information encompasses details about the activeflow’s current state, including completed and pending actions. Additionally, the activeflow offers a control interface that empowers users to manage the execution process. This interface enables actions such as stopping the activeflow at any point and modifying its configuration or parameters as needed.

Activeflow Lifecycle

The activeflow executes the actions until one of the following conditions is met:

  • Main Service Type Completion: The activeflow continues executing flow actions until the primary service type is completed. For instance, in the case of a call service, actions will be executed until the call is hung up.

  • Stop Action Execution: Execution ceases if an action with the type “stop” is encountered in the flow.

  • User-Initiated Interruption: Users can actively interrupt their activeflow by sending a POST request to the endpoint: https://api.voipbin.net/v1/activeflows/<activeflow-id>/stop.

Executed Actions

Within the CPaaS environment, flows can be complex, incorporating various service types such as call, SMS, chat, and more. Handling history logs for these diverse services requires a structured approach.

VoIPBin simplifies the tracking of executed actions by providing a comprehensive history log within the activeflow. Unlike traditional telephony services with straightforward flows, CPaaS services demand a more flexible approach due to their diverse nature.

In VoIPBin, each action in the activeflow defines a distinct step in the service’s behavior. This ensures clarity in tracking the sequence of actions performed.

{
    "executed_actions": [
        {
            "type": "connect",
            "option": {
                "source": {
                    "type": "tel",
                    "target": "+821021656521"
                },
                "destinations": [
                    {
                        "type": "tel",
                        "target": "+821021546521"
                    }
                ]
            }
        },
        {
            "id": "605f5650-ba92-4dcd-bdac-91fcf6260939",
            "next_id": "00000000-0000-0000-0000-000000000000",
            "type": "message_send",
            "option": {
                "text": "hello, this is a test message.",
                "source": {
                    "type": "tel",
                    "target": "+821021656521"
                },
                "destinations": [
                    {
                        "type": "tel",
                        "target": "+31616818985"
                    }
                ]
            }
        }
    ]
}

With the detailed information provided in the executed_actions array, customers can easily review and understand the history logs of their CPaaS services.

Activeflow

Activeflow

{
    "id": "<string>",
    "customer_id": "<string>",
    "flow_id": "<string>",
    "status": "<string>",
    "reference_type": "<string>",
    "reference_id": "<string>",
    "current_action": {
        ...
    },
    "forward_action_id": "<string>",
    "tm_create": "<string>",
    "tm_update": "<string>",
    "tm_delete": "<string>"
}
  • id: Activeflow’s ID.

  • customer_id: Customer’s ID.

  • flow_id: Flow’s ID.

  • status: Activeflow’s status. See detail here.

  • reference_type: Represent which resource started activeflow.

  • reference_id: Referenced type’s ID.

  • current_action: Currently running actino on this activeflow. See detail here.

  • forward_action_id: Forward action id.

Example

{
    "id": "6f18ae1c-ddf8-413b-9572-ad30574604ef",
    "customer_id": "5e4a0680-804e-11ec-8477-2fea5968d85b",
    "flow_id": "93993ae1-0408-4639-ad5f-1288aa8d4325",
    "status": "ended",
    "reference_type": "call",
    "reference_id": "fd581a20-2606-47fd-a7e8-6bba7c294170",
    "current_action": {
        "id": "93ebcadb-ecae-4291-8d49-ca81a926b8b3",
        "next_id": "00000000-0000-0000-0000-000000000000",
        "type": "digits_receive",
        "option": {
            "length": 1,
            "duration": 5000
        }
    },
    "forward_action_id": "00000000-0000-0000-0000-000000000000",
    "tm_create": "2023-04-06 14:53:12.569073",
    "tm_update": "2023-04-06 14:54:24.652558",
    "tm_delete": "9999-01-01 00:00:00.000000"
}

Status

Activeflow’s status.

Type

Description

EMPTY

None

running

Activeflow is running.

ended

Activeflow has stopped.

Reference type

Tiggerred resource.

Type

Description

EMPTY

None

call

Call resource started the activeflow.

sms

SMS resource started the activeflow.

Tutorial

Get activeflow list

Getting a list of activeflows.

$ curl -k --location --request GET 'https://api.voipbin.net/v1.0/activeflows?token=eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJleHAiOjE2MTI4NDIyMjcsInVzZXIiOnsiaWQiOjEsInBlcm1pc3Npb24iOjEsInVzZXJuYW1lIjoiYWRtaW4ifX0.OWJihCRfaRtQKtV9fmfgxtpMk6TMQQtq9cSefln7vxM'

{
    "result": [
        {
            "id": "6f18ae1c-ddf8-413b-9572-ad30574604ef",
            "customer_id": "5e4a0680-804e-11ec-8477-2fea5968d85b",
            "flow_id": "93993ae1-0408-4639-ad5f-1288aa8d4325",
            "status": "ended",
            "reference_type": "call",
            "reference_id": "fd581a20-2606-47fd-a7e8-6bba7c294170",
            "current_action": {
                "id": "93ebcadb-ecae-4291-8d49-ca81a926b8b3",
                "next_id": "00000000-0000-0000-0000-000000000000",
                "type": "digits_receive",
                "option": {
                    "length": 1,
                    "duration": 5000
                }
            },
            "forward_action_id": "00000000-0000-0000-0000-000000000000",
            "tm_create": "2023-04-06 14:53:12.569073",
            "tm_update": "2023-04-06 14:54:24.652558",
            "tm_delete": "9999-01-01 00:00:00.000000"
        },
        ...
    ],
    "next_page_token": "2023-04-02 13:43:30.576077"
}

Stop activeflow

Stop the activeflow.

$ curl --location --request POST 'https://api.voipbin.net/v1.0/activeflows/1cb0566c-6aa5-45fd-beb7-e71a968075ea/stop?token=eyJhbGciOiJIzI1NiIsInR5cCI6IkpXVCJ9.eyJjdXN0b21lciI6IntcImlkXCI6XCI1ZTRhMDY4MC04MDRlLTExZWMtODQ3Ny0yZmVhNTk2OGQ4NWJcIixcInVzZXJuYW1lXCI6XCJhZG1pblwiLFwibmFtZVwiOlwiYWRtaW5cIixcImRldGFpbFwiOlwiYWRtaW4gYWNjb3VudFwiLFwid2ViaG9va19tZXRob2RcIjpcIlBPU1RcIixcIndlYmhvb2tfdXJpXCI6XCJodHRwczovL2VubG1ieXVqamowbWcueC5waXBlZHJlYW0ubmV0XCIsXCJsaW5lX3NlY3JldFwiOlwiYmE1ZjA1NzVkODI2ZDViNGEwNTJhNDMxNDVlZjEzOTFcIixcImxpbmVfdG9rZW5cIjpcInRzZklpREIvMmNHSTVzSFJNSW9wN1MzU1M0S3NiRWxKL3VrUUtzNkxwSFkxWG9HMnBUTUhxZGl5TE51OGFNZGEycGkzdlRYc2NDS3A4WEdFdmZsNmRtSVQxbmZUVGRNa21ZODRpUkxJT0lBbDg1aUcvWFp1ZUkxV0JSdmNoZlY4VGxad0RtRUNiU1N6TCtXdXYrak8rZ2RCMDR0ODkvMU8vdzFjRG55aWxGVT1cIixcInBlcm1pc3Npb25faWRzXCI6W1wiMDM3OTZlMTQtN2NiNC0xMWVjLTlkYmEtZTcyMDIzZWZkMWM2XCJdLFwidG1fY3JlYXRlXCI6XCIyMDIyLTAyLTAxIDAwOjAwOjAwLjAwMDAwMFwiLFwidG1fdXBkYXRlXCI6XCIyMDIzLTAyLTIaxIDA4OjAxOjEyLjI2MDM4OFwiLFwidG1fZGVsZXRlXCsI6XCI5OTk5LTxLTAxIDAwOjAwOjAwLjAwMDAwMFwifSIsImV4cCI6MTY4MTQ4NzM5MH0.IndaMTiaHzPU5kg6f--WnUNizM5sCa5zcPwD0CF3cw'

{
    "id": "1cb0566c-6aa5-45fd-beb7-e71a968075ea",
    "customer_id": "5e4a0680-804e-11ec-8477-2fea5968d85b",
    "flow_id": "93993ae1-0408-4639-ad5f-1288aa8d4325",
    "status": "ended",
    "reference_type": "call",
    "reference_id": "cd40b5f5-dafc-43e6-9b70-38edc1155a0f",
    "current_action": {
        "id": "f9720d64-a8a8-11ed-8853-3f29a447aac1",
        "next_id": "00000000-0000-0000-0000-000000000000",
        "type": "talk",
        "option": {
            "text": "Hello. Welcome to the voipbin service. Please select the service. For simple talk, press 1. For simple transcribe, press 2. For queue join, press 3. For voicemail, press 4. For conference. press 5. For chatbot talk, press 6. For contact to the project developer, press 0",
            "gender": "female",
            "language": "en-US",
            "digits_handle": "next"
        }
    },
    "forward_action_id": "00000000-0000-0000-0000-000000000000",
    "tm_create": "2023-04-07 17:23:33.665475",
    "tm_update": "2023-04-07 17:23:52.561527",
    "tm_delete": "9999-01-01 00:00:00.000000"
}