Skip to content

Grid (Enreach Contact)

This module contains functions to interact with and retrieve information from the connected Grid UCaaS phone platform.

Grid.get_account()

Retrieve detail information of the connected Grid account.

Example return value:

%{
  data: %{
    "audio_files" => %{
      "music_on_hold" => ["1-z2bj9.wav", "1-mxn0s.wav",
       "1-rya3h.wav,1-7ynkc.wav", "SoundFiles_EN/1.wav", "SoundFiles_EN/2.wav",
       "SoundFiles_EN/3.wav"]
    },
    "calllimit" => "3",
    "country" => "NL",
    "deviceswitch_extension" => "909",
    "language" => "en",
    "q_type" => "coligo",
    "system_extensions" => %{
      "call_pickup" => "908",
      "device_switch" => "909",
      "extension_configure_external_forwards" => "910",
      "helpdesk" => %{"destination" => "0367600000", "number" => "1200"},
      "listen_in" => "906",
      "parking_retrieve" => "930",
      "phone_change_pincode" => "907",
      "phone_login" => "901",
      "phone_login_status" => "900",
      "phone_logout" => "902",
      "queue_join" => "903",
      "queue_leave" => "904",
      "record_audio" => "905",
      "timeplan_update" => "915",
      "user_voicemail_management" => "1233",
      "voicemail_management" => "920"
    }
  },
  id: "468f90ea-0590-4312-855f-8c9affb32e0b",
  name: "voiceworks.com",
  type: "company",
  external_reference: "100"
}

Grid.get_extension(extension_number)

Return information about a single extension in the account.

%{
  :number => "899",
  :external_reference => "100899",
  "account_external_reference" => "100",
  "allow_individual_forward" => "0",
  "areacode" => nil,
  "country_code" => "nl",
  "country_id" => "1",
  "ext_type" => "Queue",
  "language_code" => "nl_NL",
  "language_name" => "NL",
  "name" => "Queue Test",
  "password" => "0000",
  "queue_data" => %{
    "announce" => 1,
    "announce_filename" => "queue_announcements/996c062c-59d9-4b8f-86ff-57e21ebfa351-Welkom test.mp3",
    "announce_interval" => 40,
    "dtmf_transfer_disabled" => 0,
    "forward" => 5,
    "forward_dest" => "512",
    "forward_no_agents" => 0,
    "forward_no_agents_dest" => "512",
    "forward_time" => 30,
    "group_allowforward" => 0,
    "maxlen" => 10,
    "members" => ["100_111", "100_222"],
    "moh" => 1,
    "moh_files" => ["moh/607e8d84-b463-4e06-9602-d95c1b8ca330-Ojala SilVio RodrigueZ.mp3"],
    "name" => "Queue Test",
    "offer_second_call" => 0,
    "que_infotainment" => "queue_infotainment/df0f7ce2-ec42-4201-865c-17ab9aef5e4d-Welkom test.mp3",
    "skip_announce_when_empty" => 0,
    "strategy" => "roundrobin",
    "timeout" => 40,
    "to_voicemail" => 1,
    "to_voicemail_dest" => "333",
    "weight" => 0,
    "wrapuptime" => 0
  },
  "queues" => %{},
  "tbr_failto" => nil
}

Grid.get_queue_info(extension_number)

Return realtime information about the given queue extension.

%{
  queue: %{
    name: "Queue Test",
    status: "active",
    extension: "899",
    strategy: %{name: "roundrobin", description: ""},
    queue_id: "899@100.voiceworks.com",
    open_queue: 1,
    agents: ["333@100.voiceworks.com"],
    calls_counter: %{connected: 1, dropped: 3},
    actual_time: 1717077550,
    all_assigned: ["333@100.voiceworks.com"]
  },
  extension: %{},
  extra: %{
    caller_state_counts: %{waiting: 3},
    expected_wait_time: 120
  }
}

Grid.get_roster()

Retrieve the full roster of the account.

%{
  extensions: %{
    "05a6f377-1d61-4b01-8756-d7853849dd9c" => %{
      extension: "236@1.voiceworks.com",
      extension_id: "05a6f377-1d61-4b01-8756-d7853849dd9c",
      extension_type: "Unknown",
      displayname: "Unnamed"
    },
    "338452aa-a789-41d4-8461-08ef04d07cfe" => %{
      extension: "816@1.voiceworks.com",
      extension_id: "338452aa-a789-41d4-8461-08ef04d07cfe",
      extension_type: "Unknown",
      displayname: "Unnamed"
    }
  },
  users: %{
    "06a24b65-b102-4b96-9d54-717e8e93e795" => %{
      extension: "333",
      user_id: "06a24b65-b102-4b96-9d54-717e8e93e795",
      identity: "rc3@1.voiceworks.com",
      displayname: "Guy 3",
      call_activity: :none,
      presence_code: "offline",
      presence_message: "user is offline"
    }
  },
  members: %{
    "77e7ced6-0465-4077-b17d-ac0d680598021e621736-2de8-42d3-bf56-ba1717887833" => %{
      user_id: "1e621736-2de8-42d3-bf56-ba1717887833",
      group_id: "77e7ced6-0465-4077-b17d-ac0d68059802"
    }
  }
}

Grid.list_extensions()

Returns a list of all extensions in the account.

[
  %{
    type: :unknown_extension,
    extension: %{
      :number => "111",
      :external_reference => "100111",
      "account_external_reference" => "1",
      "anonymous_caller_id" => "313612345678",
      "areacode" => "20",
      "country_id" => "1",
      "ext_type" => "User",
      "identity_type" => "EXTENSION",
      "language_name" => "EN",
      "password" => "0000",
      "queues" => %{},
      "reach_persona" => "rc1"
    }
  },
  %{
    type: :unknown_extension,
    extension: %{
      :number => "222",
      :external_reference => "100222",
      "account_external_reference" => "1",
      "anonymous_caller_id" => "313612345678",
      "areacode" => "20",
      "country_id" => "1",
      "ext_type" => "User",
      "identity_type" => "EXTENSION",
      "language_name" => "EN",
      "password" => "1111",
      "queues" => %{},
      "reach_persona" => "rc2"
    }
  }
]

Grid.list_users()

Retrieve the list of users from the roster, ordered by extension.

[%{
   extension: "333",
   user_id: "06a24b65-b102-4b96-9d54-717e8e93e795",
   identity: "rc3@1.voiceworks.com",
   displayname: "Guy 3",
   call_activity: :none,
   presence_code: "offline",
   presence_message: "user is offline"
}]

Grid.user_busy?(extension)

Returns true when the given user extension is busy.