Jump to content

Barge


Jack Noe

Recommended Posts

Hi all.

Is there anyone that set up a Barge feature to work with 2600 ?

If someone can help us with this, to get it set up. 

What we need is:

Listen in to an employee while on the phone either muted, where the employee, and the other party dont know,

Or talk to the employee   

 

 

Link to comment
Share on other sites

We are using the eavesdrop feature, but that's in our own hosted Kazoo cluster. But I thought that all features in the open source version is available in the 2600hz hosted one?

If I remember correctly we did a simple PHP script invoked via Pivot. The manager can monitor the agents by dialing a feature code followed by the extension he wants to listen to (*68*101 or *68*102 etc).
We then programmed his phone to have those codes in the soft keys, so he just has to press one key to listen :)

Link to comment
Share on other sites

Sure!
Here's the main part of our PHP script invoked by pivot from a feature code (*68). I hope I didn't missed something.
It uses https://github.com/2600hz/kazoo-php-sdk, basically in the find_user_id_from_extension function, but it should be possible to do that with Kazoo API and curl also.

<?php

### Todo:
# Permissions, system for who is permitted to eavesdrop on which users
#  Now all users in same account is permitted to eavesdrop all

require_once "kazoo-php-sdk/vendor/autoload.php";

date_default_timezone_set('Europe/Stockholm');
$date_format = 'Y-m-d H:i:s';
$logfile = "/var/log/kazoo/eavesdrop.log";
$feature_code_length = 3;  # Length of feature code (*68 = 3)

$account_id = $_GET['Account-ID'];
$user_id = $_GET['User-ID'];
$caller_user_id = $_GET['User-ID'];
$request = $_GET['Request'];
$extn = substr($request, $feature_code_length);	# Strip feature code to get extension to eavesdrop

if (!function_exists('AppendLogFile')) {
	function AppendLogFile($logstring){
		global $logfile, $logfile_handle, $date_format;
		$datestring = date($date_format);
		if (fwrite($logfile_handle, "$datestring; $logstring\n") === FALSE) echo("** Error: Cannot write to logfile $logfile! **\n\n");
	}
}

function get_sdk($api_key_function) {
	require_once "kazoo-php-sdk/vendor/autoload.php";
	$options = array('base_url' => 'http://localhost:8000');
	$auth_token = new \Kazoo\AuthToken\ApiKey($api_key_function);
	$sdk = new \Kazoo\SDK($auth_token, $options);
	return $sdk;
	exit();
}

function find_user_id_from_extension($sdk, $account_id, $extn) {
	$users = $sdk->Account($account_id)->Users();
	foreach($users as $element) {
		$presence_id = $element->presence_id;
		if ($presence_id == $extn) {
			return $element->id;
			exit;
		}
	}
}


if (!$logfile_handle = fopen($logfile, 'a')) { ### Open logfile
	die("** Error: Failed to open logfile $logfile! **");
}

$sdk = get_sdk($master_api_key);
$user_id = find_user_id_from_extension($sdk, $account_id, $extn);

AppendLogFile("Starting eavesdrop on user_id $user_id from $caller_user_id in account $account_id.");

header("content-type: application/json");
echo ('{"module":"eavesdrop","data":{"user_id":"'.$user_id.'", "approved_user_id": "'.$caller_user_id.'"}}');

 

Edited by tomas_ (see edit history)
Link to comment
Share on other sites

  • 2600Hz Employees
On 3/17/2018 at 10:58 AM, Josh Robbins said:

it doesn't work - I get a system message saying "no channels" and then she hangs up on me. This must be disabled on the hosted platform. Booooooo

If you are hearing a recording it is enabled but didn't find any matching channels.

Link to comment
Share on other sites

yep - got it working yesterday with the help of Darren at Fast Device. It turns out it doesn't work without an approved_group_id with the listening user in part of that group. 

So anyone know about whisper or barge now that we got monitor working? I found something called "intercept": https://github.com/2600hz/kazoo/blob/5e877f684639fa655de973e9295abf1cb74c8957/applications/callflow/doc/intercept.md

is that barge possibly?

Link to comment
Share on other sites

@tomas_ oddly enough, it didn't work on Josh's account using the user id. However, It did work on mine. Once we switched to using the group id, it worked perfectly for him. That's the right approach anyway for security reasons, but I'm uncertain why the behavior is different between reseller accounts. My only thought is he subscribes to Qubicle and I don't.  

Link to comment
Share on other sites

×
×
  • Create New...