Page 1 of 1

Click to Call on Website [Outside the dialer]

PostPosted: Tue Apr 02, 2013 6:37 pm
by ccetech20
Hi

Is there a possibility that a click to call functionality can be added to any website?

It would be nice, lets say, there is a website hosted at a server X. Now we place a small form on it OR button on it which lets user put in name and number; the moment he/she presses submit, the number gets connected to the person as well as vicidial/goautodial.

This way the call can be established instantly. You might wonder why would a person need it; but to have a complete end to end analysis of traffic on your website, this can come in handy.
:)
I am sure, geniuses here have already found the solution :)

Eagerly awaiting.

Re: Click to Call on Website [Outside the dialer]

PostPosted: Tue Apr 02, 2013 6:41 pm
by williamconley
you would use the non-agent api to add the new lead to your campaign and to the hopper. then the dialing occurs as soon as there is an agent (immediately if one is already available). good to "one-off" it, of course, and use a form that sends data to a PHP page that accepts the data and then passes it to Vicidial "if appropriate" to keep the general public OFF your vicidial server.

Re: Click to Call on Website [Outside the dialer]

PostPosted: Tue Apr 02, 2013 6:48 pm
by ccetech20
woah!!!

Quick.. thanks William.

:cry: I'm afraid I do not understand any of it, I am still a newbie at this :-)

Just tried being a bit ambitious.. I am posting a small article that I researched just now; if you could help us get it going:

Source:http://pracapps.blogspot.in/2011/08/click-to-call-from-public-website.html
platform: Asterisk Trix

You have some basic understanding of PHP/Asterisk/Javascript

You know your way around the freepbx layout.

What we need to do on the Asterisk side is login to web admin section and create a new queue.


With that queue leave all the static agents blank, or else the image will display constantly even when you don't want to take calls.

Then create a directory in web(apache/httpd) directory which we will use for access from the public website. in that directory we are going to have a few files:


index.php ( the php script to do the calling )

callingscript.js ( the main chunk of javascript )

callback.png ( the image to display )


We are only using 1 image, i.e. an online image the code is very easy to change to include an offline image if you want. In this example everything will reference http://call.pracapps.com.au/callback and will live in /var/www/html/callback

First lets start out with index.php

Code: Select all
<?
header("Access-Control-Allow-Origin: *");
header("Access-Control-Allow-Methods: POST, GET");
$queue = '7';// change this to the queue you have created on your system
$asterisk_location = '/usr/sbin/asterisk';
$command = "$asterisk_location -rx 'queue show $queue'";
if( !empty($_REQUEST['callback_number']) ) // this is the do the call part
{
require_once('/var/lib/asterisk/agi-bin/phpagi-asmanager.php');
$ami = new AGI_AsteriskManager();
$ami->connect();
$ami->originate("Local/$queue@from-internal", $_REQUEST['callback_number'], "from-internal", "1");
die('Your Call has been placed and your phone should be ringing shortly.');
} else { // display the javascript
exec($command, $output);
if(trim($output[1]) == 'Members:')
{
echo file_get_contents('http://ajax.googleapis.com/ajax/libs/jquery/1.6.2/jquery.min.js');
echo file_get_contents('http://ajax.googleapis.com/ajax/libs/jqueryui/1.8.15/jquery-ui.min.js');
include('callingscript.js');
}
}
?>


In the index.php file you will need to edit line 4:
$queue = '7'; // change this to the queue you have created on your system
Then we have the callingscript.js, and just change line 1

Code: Select all
base_url = 'http://call.pracapps.com.au/callback';
$('#callback').append(
$('<div></div>')
.append(
$('<img></img>')
.attr( { src: base_url + '/callback.png' } )
.click(function() { $('#callback-details').dialog('open'); } )
)
.append(
$('<div></div>')
.attr( { id: 'callback-details', title: 'Call Me Now' } )
.append(
$('<span>Please enter your number</span><br>')
)
.append(
$('<input></input>')
.attr( { name : 'callback_number', size : '20', id: 'callback_number' } )
)
)
);
var link = document.createElement('link');
link.type = 'text/css';
link.rel = 'stylesheet';
link.href = 'http://ajax.googleapis.com/ajax/libs/jqueryui/1.8.15/themes/base/jquery-ui.css';
document.head.appendChild(link);

$(function() {
$('#callback-details').dialog({
autoOpen: false,
height: 300,
width: 350,
modal: true,
buttons: {
" Call Me ": function() {
$.ajax({
url: base_url+'/index.php',
data:{ callback_number: $('#callback_number').val() },
dataType: "text",
success: function(data){
$('#callback-details').dialog('close');
$('#callback').append(
$('<div>'+data+'</div>')
.attr( { id: 'callback-response', title: 'Your Call Status' } )
);
$('#callback-response').dialog({
height: 300,
width: 350,
});
}
});
$(this).dialog('close');
},
" Cancel ": function() {
$(this).dialog('close');
}
}
});
});

Then all we need to is log into queue from an extension to make it activate it. in the above example on a standard freepbx system it would be 7* and then 7** when their shift is finished.


What I do not understand is how to create a queue in the system. I could gather the code mentioned above a bit but fail to understand queue creation and how will we have agents login to the queue.

Re: Click to Call on Website [Outside the dialer]

PostPosted: Tue Apr 02, 2013 7:20 pm
by williamconley
this is apparently an article for setting up something in asterisk and not in Vicidial for a simple "call-both-people" click to dial scenario. for help with this, you'll need to be in an asterisk forum as it has nothing to do with Vicidial. although it would likely work in a Vicidial system, properly configured, it is merely outside the purpose of this particular Vicidial Forum because it will in no way use any vicidial functionality. While we do deal with this, we don't provide this sort of support free on the Vicidial Free Support Forum. I hope you understand :)

Re: Click to Call on Website [Outside the dialer]

PostPosted: Wed Apr 03, 2013 6:59 pm
by gers55
Check out post on strikers blog. Might be what your after. Might Not :D

http://striker24x7.blogspot.co.uk/2012/ ... -from.html

Re: Click to Call on Website [Outside the dialer]

PostPosted: Tue Apr 09, 2013 12:16 pm
by striker
hi
the above blog is used to highlight the numbers(or dial the numbers form webpage ) in a webpage opened in mozilla firefox .
by clicking the highlighted number a call will be established between your extension configured in Telify mozilla addon ( as shown in picture) and the number clicked.

.
for your requirement , you need to use the non-agent api
check this link http://www.vicidial.org/docs/NON-AGENT_API.txt
and check this topic : add_lead
the api :
http://server/vicidial/non_agent_api.php?source=test&user=6666&pass=1234&function=add_lead&phone_number=7275551212&phone_code=1&list_id=999&first_name=Bob&last_name=Wilson


your webform should parse this url to add the lead to list 999 which is selected in any autodialling active campaign.
hint: http://server/vicidial/non_agent_api.ph ... e_number=${mobilenumer)&phone_code=1&list_id=999&first_name=${name}&last_name=${lastname}