How to create a "call me now button" on website

lakeman

Joined
Aug 31, 2009
Messages
1
Likes
0
Points
0
#1
I want to create (and resell) call me now buttons for websites.
It should work with the elastix pbx ofcourse
How to do this.
(create an event....? but how....) or else....
please help me a bit.
Peter Lakeman
 

dicko

Joined
Oct 24, 2008
Messages
4,099
Likes
0
Points
0
#2

Chilling_Silence

Joined
Sep 23, 2008
Messages
488
Likes
0
Points
0
#3
This code may help you, you'll just need a web-form to submit the relevant variables. We've even incorporated stuff like this into emails / email marketing. It unfortunately had very limited success :-/

Code:
<?php
$strHost = "10.179.0.38";
$strUser = "Click2Call";
$strSecret = "ThisLittePiggyWentToMarket";
#specify the channel (extension) you want to receive the call requests with
#e.g. SIP/XXX, IAX2/XXXX, ZAP/XXXX, etc
# $strChannel = "SIP/209";
$strChannel = $_REQUEST['exten'];

#specify the context to make the outgoing call from.
#Using from-internal will make your outgoing dialing rules apply
$strContext = "from-internal";

#specify the amount of time you want to try calling the specified channel before hangin up
$strWaitTime = "30";

#specify the priority you wish to place on making this call
$strPriority = "1";

#specify the maximum amount of retries
$strMaxRetry = "2";

$number=strtolower($_REQUEST['number']);
$pos=strpos ($number,"local");
if ($number == null) :
 exit() ;
endif ;
if ($pos===false) :
$errno=0 ;
$errstr=0 ;
$strCallerId = "Web Call <$number>";
$oSocket = fsockopen ($strHost, 5038, &$errno, &$errstr, 20);
 if (!$oSocket) {
  echo "$errstr ($errno)<br>\n";
} else {
fputs($oSocket, "Action: login\r\n");
fputs($oSocket, "Events: off\r\n");
fputs($oSocket, "Username: $strUser\r\n");
fputs($oSocket, "Secret: $strSecret\r\n\r\n");
fputs($oSocket, "Action: originate\r\n");
fputs($oSocket, "Channel: $strChannel\r\n");
fputs($oSocket, "WaitTime: $strWaitTime\r\n");
fputs($oSocket, "CallerId: $strCallerId\r\n");
fputs($oSocket, "Exten: $number\r\n");
fputs($oSocket, "Context: $strContext\r\n");
fputs($oSocket, "Priority: $strPriority\r\n\r\n");
fputs($oSocket, "Action: Logoff\r\n\r\n");
sleep(2);
fclose($oSocket);
 }
echo "Extension $strChannel should be calling $number." ;
else :
 exit() ;
endif ;
?>
 

dwells

Joined
Sep 29, 2009
Messages
127
Likes
0
Points
0
#4
I have successfully adapted this code to use inside our network. It works 100% with our Polycom Phones, SNOM's, Granstream's and X-Lite's.

I mentioned this somewhere else in the forum, but I have made a dynamic phonebook (for internal use) inside our VPN, which reads, and dynamically creates a click to call link, and I have encorperated Click2Call (with MANY MANY changes). After a user is forced to enter his/her extension, a cookie is set, then the phonebook menu gets listed...the phonebook is then a single click to call tool. Dynamic, Searchable and Live from our (3)server's DB.

My point is this code works very well. I just don't know how well it would work for someone, outside the network realm.

My only though was to modify this code even farther and get a user input for a call back number and invoke the call back module, and set it to ring a static group of phones. So even if it's an email link, they can be brought to a page to get the call info, and invoke the call back. They can be put in to a call queue where your ready to answer agents are standing by.
 

apmuthu

Joined
Aug 1, 2009
Messages
60
Likes
0
Points
0
#5
On what device / application will the web page visitor receive the call when they click the web call button? If they have a softphone application which is configured to access the eleastix, then the webcall button is redundant!
 

apmuthu

Joined
Aug 1, 2009
Messages
60
Likes
0
Points
0
#6
Answered!

The code asks for 2 variables exten and number from the submitting form. Hence the call will go to the local number.
 

cheeks

Joined
Apr 11, 2009
Messages
49
Likes
0
Points
0
#7
Dwells hope you can help me

Please can you explain how you created a " dynamic phonebook (for internal use) " for elastix as that is what i urgently need to do.

Any help greatly Appreaciated
 

dwells

Joined
Sep 29, 2009
Messages
127
Likes
0
Points
0
#8
cheeks,

no problem, I hope.

There are 2 things to say here. First, there is an internal phonebook module under the Agenda tab; called "Address Book". This is most likely going to be the easiest to get to use right away. It has interal and external numbers with a filter, which also uses a built in "Click2Dial" button. It's good!

I made a little more or less advanced yet still simple, PHP + MySQL web that accesses the 'asterisk.devices' table and returns with everything internal, as well as a new column I added for 'altnum' for cell phones for those users all in one. (I also made a small admin page to inject the cell numbers easily)
My web has regional area menus for our sub offices(using spry accordian menu) around North America and a search(by f/l name or exten) area that also creates a click to dial link when it returns. Somewhere in there there is a link to a usage PDF manual as well.

The links that get created dynamically, call on the Click2Dial procedures, invoking the cookie session(ONLY ONE LONG TERM COOKIE[sets EXTEN variable]; that being said I created the LOGOUT link on the web page) then continuing the dial. Originaly the links just contained a dynamic URI (SIP/xxx@domain) no cookies...and no security :( This was origianlly meant for use with just X-Lite as the systems recognized URI dialer. Since we now have 5 different type of SIP devices, 4 not software based, this didn't cut it anymore.

So in the nut shell, Read the extension from devices table, create an HTML link that calls the C2D pages (passing the right variables (and don't do them in frames (pop up a _blank target)))
The link will look like this sorta (https://your.domain/c2c/location/c2c.ph ... r=VARIABLE).

It's a little long winded as I usually am, but it was quite the undertaking to understand what needed to be done. Now it's a little more personalized and a little nicer to look at with style sheets and folding menus.
 

cheeks

Joined
Apr 11, 2009
Messages
49
Likes
0
Points
0
#9
dwells thanks for the reply, much appreciated

i am looking at AsteriDex 4 and want to know if you think that it may be an easier solution?

thanks again for you help
 

dwells

Joined
Sep 29, 2009
Messages
127
Likes
0
Points
0
#10
ok sorry for this but i'm getting sick of the time out crap on this message board...
I had a real nice explanation for you but now it's lost in cyber space, damn it!

in a nut shell I said use the Elastix address book.

futher to that if you do try Astridex post and tell us how it went.
 

Patrick_elx

Joined
Dec 14, 2008
Messages
1,120
Likes
0
Points
0
#11
Re:How to create a

dwells said:
ok sorry for this but i'm getting sick of the time out crap on this message board...
It happened to me more than once... Just try to remember to do a preview from time to time to avoid it.
 

Staff online

Members online

Latest posts

Forum statistics

Threads
30,898
Messages
130,879
Members
17,560
Latest member
manuelc
Top