Koozali.org: home of the SME Server

click-to-call and egroupware [DONE]

Offline fpausp

  • *
  • 728
  • +0/-0
Re: click-to-call and egroupware [DONE]
« Reply #15 on: April 12, 2008, 11:26:49 PM »
Hello soprom,

Thanks for your wonderful howto, i have done all the steps but i got:

Error with socket for 1234567890

How can i fix this ?


regards
fpausp
Viribus unitis

Offline soprom

  • *
  • 589
  • +0/-0
    • www.logiciel-libre.org
Re: click-to-call and egroupware [DONE]
« Reply #16 on: April 13, 2008, 12:16:34 AM »
Try to give a little more info...
- Are PBX and Egroupware on the same machine?
- What is the link under the phone number in the addressbook?

Change the line after $oSocket like this, in order to hae more info on the error:

if (!$oSocket) {
   echo "<br>Error with socket for $number error $errno $errstr";
« Last Edit: April 13, 2008, 01:38:43 AM by soprom »
Sophie from Montréal

Offline soprom

  • *
  • 589
  • +0/-0
    • www.logiciel-libre.org
Re: click-to-call and egroupware [DONE]
« Reply #17 on: April 13, 2008, 01:52:20 AM »
Error creating a socket must have to do with permissions. So you might check that pbx address and manager account are ok.
Sophie from Montréal

Offline fpausp

  • *
  • 728
  • +0/-0
Re: click-to-call and egroupware [DONE]
« Reply #18 on: April 13, 2008, 10:14:40 AM »
Hi,

Quote
Try to give a little more info...
- Are PBX and Egroupware on the same machine?
- What is the link under the phone number in the addressbook?

Change the line after $oSocket like this, in order to hae more info on the error:

if (!$oSocket) {
   echo "<br>Error with socket for $number error $errno $errstr";

1. PBX and Egroupware are on the same machine
2. The link is: http://192.168.1.246/pbx/call.php?number=1234567890&accountname=admin&account=5000
3. I changed the line, the output is: Error with socket for 1234567890 error 111 Connection refused
Viribus unitis

Offline soprom

  • *
  • 589
  • +0/-0
    • www.logiciel-libre.org
Re: click-to-call and egroupware [DONE]
« Reply #19 on: April 13, 2008, 04:36:49 PM »
First, check in manager.conf since I forgot to mention a change in [general]. See below.

Double-check that manager.conf has the same username and secret as in your script;
if you kept the default one, it should look like this:

(if PBX=192.168.1.246)

[remote_mgr]
secret=0chanc3yo
deny=0.0.0.0/0.0.0.0
permit=127.0.0.1/255.255.255.0
;
;Allow LAN connections
permit=192.168.1.0/255.255.255.0
;
;writetimeout=100
;Authorization
read=system,call,log,verbose,command,agent,user
write=system,call,log,verbose,command,agent,user
;

I see that I forgot to mention this change in manager.conf:

[general]
enabled=yes
port=5038
;bindaddr=127.0.0.1
;
;Listen on the LAN interface
bindaddr=192.168.1.246

;
displayconnects=yes
;

Call.php should have matching lines:

# pbx server address:
$strHost = "192.168.1.246";   

#specify the username you want to login with (in /etc/asterisk/manager.conf)
$strUser = "remote_mgr;

#specify the password for the above user
$strSecret = "0chanc3yo";   


Jeff could confirm this, but I think that asterisk must be restarted, not just reloaded.
For your tests, use the default manager account and be patient, I had the same issue and asterisk will accept connections.

Use this command to see the account on the PBX:

pbx*CLI> manager show user remote_mgr
       username: remote_mgr
         secret: <Set>
           deny: 0.0.0.0/0.0.0.0
         permit: 192.168.1.0/255.255.255.0
           read: system,call,log,verbose,command,agent,user
          write: system,call,log,verbose,command,agent,user
displayconnects: no
« Last Edit: April 13, 2008, 04:58:48 PM by soprom »
Sophie from Montréal

Offline SARK devs

  • ****
  • 2,806
  • +1/-0
    • http://sarkpbx.com
Re: click-to-call and egroupware [DONE]
« Reply #20 on: April 13, 2008, 05:54:41 PM »
in theory you should be able to do "reload manager" at the console but "restart now" is fewer letters anyway :)

Best

J

 

Offline soprom

  • *
  • 589
  • +0/-0
    • www.logiciel-libre.org
Re: click-to-call and egroupware [DONE]
« Reply #21 on: April 13, 2008, 08:45:23 PM »
Also, the script must take care of the cluster needed for outbound calls.
The 'default' cluster must be replaced with a cluster matching the extension called.

For that, the custom field in addressbook must be lenghten to allow for a cluster name.
I modified the script by adding this just before mysql_close();:

Code: [Select]
# Get the extension to use in the call back
# $strChannel = $row[contact_value];
list ($strContext, $strChannel) = split('[|]',$row[contact_value]);
if (strlen($strContext)==0):
$strContext = "default";
endif ;
mysql_close();

The new format for the custom field data is : "cluster_name|SIP/5000"
Without any cluster defined it should then be : "default|SIP/5000"


Sophie from Montréal

Offline fpausp

  • *
  • 728
  • +0/-0
Re: click-to-call and egroupware [DONE]
« Reply #22 on: April 13, 2008, 09:03:17 PM »
Hi,

Thank you very much, it is working now. Lets try Caller Info :-).


Best
fpausp

Viribus unitis

Offline soprom

  • *
  • 589
  • +0/-0
    • www.logiciel-libre.org
Re: click-to-call and egroupware [DONE]
« Reply #23 on: April 13, 2008, 10:07:30 PM »
I'm glag you like it!!!
The tricky part with Caller info is to handle YAACID numerous options...

I'll add some notes to the post about it.
Sophie from Montréal

Offline sonoracomm

  • *
  • 208
  • +0/-0
    • http://www.sonoracomm.com
Re: click-to-call and egroupware [DONE]
« Reply #24 on: April 17, 2008, 11:20:13 PM »
Hi Sophie,

Thanks very much for sharing this howto with us.

However, I was unable to make it work using a single SME server.

Apparently, there are many variables plus my lack of understanding of PHP keeping me from success.

As I tried to work through the howto, I ran into several 'issues':

1)  What about a configuration with just one server?  Are the instructions similar?

2)  When enabling LAN access "db configuration setprop mysqld variable value" must not be correct?

3) The GRANT command errors out with a syntax error. (may just need quotes?)

4) When creating the i-Bay, you must allow reading from 'everyone' I think?

5) When posting the call.php file, it must go in the 'html' folder, yes?

6) Does your download-able script still need to be modified for cluster awareness? Is that necessary?

In the end, if I followed the instructions as closely as possible, I get:

Failed to connect to server 192.168.0.1.

Might you have any troubleshooting tips for me?

Thanks in advance,

G

Offline sonoracomm

  • *
  • 208
  • +0/-0
    • http://www.sonoracomm.com
Re: click-to-call and egroupware [DONE]
« Reply #25 on: April 17, 2008, 11:52:49 PM »
OK, to partly answer my own...

I'm guessing this is the command to open up the mysql networking:

Code: [Select]
config setprop mysqld LocalNetworkingOnly no
After I do that, I get the pop-up:

Code: [Select]
Extension
Number 5206611293
Username admin
Originating number
Close this window

However neither 'Extension' nor 'Originating number' is populated.

???

Thanks again,

G
« Last Edit: April 18, 2008, 12:21:40 AM by sonoracomm »

Offline soprom

  • *
  • 589
  • +0/-0
    • www.logiciel-libre.org
Re: click-to-call and egroupware [DONE]
« Reply #26 on: April 17, 2008, 11:53:08 PM »
Hi sonoracomm , I'm a fan of your web site!

I'm sorry to see you have problems with click-to-call... But you might not be that far away...

The first edition of the how was missing an important thing:

Add "permit=192.168.0.0/255.255.255.0" in manager.conf, under the username section like this example:

[remote_mgr]
secret=0chanc3yo
deny=0.0.0.0/0.0.0.0
permit=127.0.0.1/255.255.255.0
;
;Allow LAN connections
permit=192.168.0.0/255.255.255.0
;

;writetimeout=100
;Authorization
read=system,call,log,verbose,command,agent,user
write=system,call,log,verbose,command,agent,user
;

1)  What about a configuration with just one server?  Are the instructions similar?
For a single machine setup the egroupware server ip address is the same as the pbx ip address.

2)  When enabling LAN access "db configuration setprop mysqld variable value" must not be correct?
For a single machine setup, this is not needed. You are right, the correct command should be:
db configuration setprop mysqld LocalNetworkingOnly  no

3) The GRANT command errors out with a syntax error. (may just need quotes?)
The howto presents the command on multiple lines. You might want to try with a single line command.

4) When creating the i-Bay, you must allow reading from 'everyone' I think?
I prefer admin (as user and group) because there are files with passwords.

5) When posting the call.php file, it must go in the 'html' folder, yes?
Yes so that it can be executed.

6) Does your download-able script still need to be modified for cluster awareness? Is that necessary?
Yes the script is updated and cluster handling appears to be required.

Thank you for helping me to get my howto better!

Sophie
« Last Edit: April 18, 2008, 12:33:20 AM by soprom »
Sophie from Montréal

Offline soprom

  • *
  • 589
  • +0/-0
    • www.logiciel-libre.org
Re: click-to-call and egroupware [DONE]
« Reply #27 on: April 18, 2008, 12:05:22 AM »
The username "admin" that you are using is defined in Egroupware and should have its custom field (addressbook) set to something like :
default|SIP/5000

"Number" should show the number you are calling,
"Originating number" is from the link variable "account" (egroupware)

There might be a problem with the link parameters typed in egroupware.
Sophie from Montréal

Offline sonoracomm

  • *
  • 208
  • +0/-0
    • http://www.sonoracomm.com
Re: click-to-call and egroupware [DONE]
« Reply #28 on: April 18, 2008, 01:00:31 AM »
Hello again,

Thanks much for your assistance.

I did finally understand that I was logged into eGroupware as 'admin' and that that was the reason the pop-up showed 'admin'.

Also, your recommendation to include the context (cluster) in the custom eGroupware extension field did enable me to dial.

However, I still don't understand this:
Quote
"Originating number" is from the link variable "account" (egroupware)

The link I have entered in "Telephony integration" is:
Quote
http://192.168.0.1/pbx/call.php?number=%1&accountname=%u&account=%t

but I don't really understand it.  'number' seems obvious, but 'accountname' and 'account', not so much.  I understand they are being pulled from the eGroupware database, but I don't understand the 'what' or the 'why'.

Is there any documentation on any of this?  I have been unable to find any save:

Quote
  Telephony integration:

    * Input field URL to link telephone numbers to: : use %1 = number to call, %u = account name, %t = account phone
    * Input field Size of popup: WxH, eg.400x300, if a popup should be used

At this point, the script is functioning, but it dials out using the wrong trunk every time.  It doesn't seem to follow the outbound SARK settings.

Thanks,

G

Offline soprom

  • *
  • 589
  • +0/-0
    • www.logiciel-libre.org
Re: click-to-call and egroupware [DONE]
« Reply #29 on: April 18, 2008, 01:25:52 AM »
I'm glad you are progressing. I had problems too and that motivated the howto.

You are quite right about naming the variable "account". It would be better to name it "account_phone".

Concerning documentation for the click-to-call, it's in the Egroupware Book and of which there is a sample chapter on the web. I think it's where I found that.

Dialing out is managed by the outbound route belonging to a cluster. You must then make sure you are using valid cluster. I don't know if context "internal" would work.

The accountname is needed because the mysql queries can find the contact_id from it. Then the script gets the extension saved in the custon field for that contact_id. This extension is finally split into cluster and channel to initiate the call.

Hope that helped...
Sophie from Montréal