Click to Call: vTiger 5.1.0 & Trixbox 2.8.0.3

thakidd
Posts: 1
Member Since:
2009-12-16

I managed to get Trixbox working with vTiger this morning. vTiger pissed me off because I read they recommend users to add sip: before all of the phone numbers added to the CRM. Personally, I think a much better way would be to have Asterisk do this so it could decide based on area codes or something...I don't know. The bottom line is, I am not going to require my customers/users to type sip: before each number they put into vTiger. From what I read, this is currently the case and would be unacceptable in my mind. Please correct if wrong, but here goes.

First of all, follow the wiki docs on getting vTiger configured. Details here: http://wiki.vtiger.com/index.php/vtiger510:Module_Asterisk

Next fire up your favorite editor and go into the /etc/asterisk directory. Open manager.conf and add the following:

[vtiger]
secret = sugarsucks
deny=0.0.0.0/0.0.0.0
permit=127.0.0.1/255.255.255.0
read = system,call,log,verbose,command,agent,user,config,dtmf,reporting,cdr,dialplan
write = system,call,log,verbose,agent,user,config,command,reporting,originate

Your username (ie vtiger) and the password here along with the permitted IP address are what goes into the PBXManager module config so they can talk to each other. If you run different boxes, make sure you change the permit info.

Once done, you need to open /var/www/html/crm/modules/PBXManager/utils/AsteriskClass.php (starting location may vary depending on where you installed vtiger...this is the "default location" for trixbox). Go ~80 lines down in the code and look for a function called transfer. Here was the original:

        function transfer($from,$to){
                $this->log->debug("in function transfer($from, $to)");
                if(empty($from) || empty($to)) {
                        echo "Not sufficient parameters to create the call";
                        $this->log->debug("Not sufficient parameters to create the call");
                        return false;
                }

                //the caller would always be a SIP phone in our case
                if(!strstr($from,"SIP")){
                        $from = "SIP/$from";
                }
                $arr = explode(":", $to);
                if(is_array($arr)){
                        $typeCalled = $arr[0];
                        $to = trim($arr[1]);
                }

                switch($typeCalled){
                        case "SIP":
                                $context = "local-extensions";
                                break;
                        case "PSTN":
                                $context = "from-inside";//"outbound-dialing";
                                break;
                        default:
                                $context = "default";
                }
                $this->createCall($from, $to, $context);
       }

And here is what I changed:

                if(!strstr($from,"SIP")){
                        $from = "SIP/$from";
                }
                // this hard codes the sip: in here so the user doesn't have to enter it into vtiger.
                $to = "sip:$to";
                $arr = explode(":", $to);
                if(is_array($arr)){
                        $typeCalled = $arr[0];
                        $to = trim($arr[1]);
                }

                switch($typeCalled){
                        case "SIP":
                                // The below context is the correct out-of-the box context for Trixbox.
                                $context = "from-internal";
                                break;
                        case "PSTN":
                                $context = "from-trunk";
                                break;
                        default:
                                $context = "default";
                }

That will do it for an easy hack to get this up and running for click to call on Trixbox. I am now going to see if I can get inbound working. Wish me luck. If I do, I will post on that too.



thejabbo
Posts: 1
Member Since:
2009-12-17
What version of tribox?

Hi,

For the last few days I have been trying to get this to work as well. I have tried AsteriskNOW and today trixbox. However everytime I click on the number the box pops up saying pick up receiver but the number never dials, any ideas?

Thanks



apaijmans
Posts: 5
Member Since:
2009-10-11
internal calls work partialy

I have done all the steps mentioned above. But only calls to internal extensions work. Calling to outside is not possible. If the extension is forwarded or ringgroups do not work either.

There are a few context missing

Forwarded extensions can not be dialed
Something in the transfer of calls goes wrong on internal calls
Also if the extension starts with * it does not work
Dialing an IVR does not work
And the context for calling outside numbers does not work.

But dialing an extensions wich is not forwarded or anything it works.

Albert



Comment viewing options

Select your preferred way to display the comments and click "Save settings" to activate your changes.