Announcement

Collapse
No announcement yet.

VoIP Integration with Twilio

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

  • VoIP Integration with Twilio

    I have bought an advanced pack for VoIP integration and the phone numbers in twilio are not syncing up.

    Before in demo account there was a scheduled job for VoIP which i thought was VoIP clean up but seems like its not the same. Can someone help me out?

    There are the current scheduled jobs in my list

    Click image for larger version

Name:	Screenshot from 2018-03-27 02:26:44.png
Views:	573
Size:	157.2 KB
ID:	36175

  • #2
    After successful configuration a Twilio connector, needed job should be created automatically. Also, you can create this job manually:

    Click image for larger version

Name:	Twilio-sync.png
Views:	0
Size:	22.1 KB
ID:	36178
    Job Offers and Requests

    Comment


    • #3
      tarasm ,

      After I added the scheduled job I started getting this

      Espo.WARNING: E_WARNING: touch(): Unable to create file data/cache/application/cronLastRunTime.php because Permission denied {"code":2,"message":"touch(): Unable to create file data/cache/application/cronLastRunTime.php because Permission denied","file":"/home/codaxtr_user/projects/unicourt-crm/espocrm/application/Espo/Core/Utils/File/Manager.php","line":503,"context":{"filePath":"dat a/cache/application/cronLastRunTime.php","defaultPermissions":{"dir":" 0775","file":"0664","user":33,"group":33},"pathPar ts":{"dirname":"data/cache/application","basename":"cronLastRunTime.php","ext ension":"php","filename":"cronLastRunTime"}}} []
      [2018-03-27 09:44:02] Espo.ERROR: Uncaught Exception Espo\Core\Exceptions\Error: "Permission denied for data/cache/application/cronLastRunTime.php" at /home/codaxtr_user/projects/unicourt-crm/espocrm/application/Espo/Core/Utils/File/Manager.php line 204 {"exception":"[object] (Espo\\Core\\Exceptions\\Error(code: 500): Permission denied for data/cache/application/cronLastRunTime.php at /home/codaxtr_user/projects/unicourt-crm/espocrm/application/Espo/Core/Utils/File/Manager.php:204)"}

      Espo.ERROR: CronManager: Failed job running, job [5aba10bdd316830fe]. Error Details: TwilioSyncPhoneNumbers: Field twilioApplicationSid is empty for connector[Twilio].

      And when I saved twilio account ID and auth token, i got following response

      1. saved
      2. connection successfully established
      3. bad response
      in that order,

      Last edited by theBuzzyCoder; 03-27-2018, 09:52 AM.

      Comment


      • #4
        The problem of file permissions on your server. Please correct them https://www.espocrm.com/documentatio...-based-systems and then disable/enable Twilio connector.
        Job Offers and Requests

        Comment


        • #5
          Thanks that worked. Now getting this warning

          Espo.WARNING: E_WARNING: Invalid argument supplied for foreach() {"code":2,"message":"Invalid argument supplied for foreach()","file":"/home/codaxtr_user/projects/unicourt-crm/espocrm/application/Espo/Modules/Voip/Hooks/VoipRouter/UpdateVoipUser.php","line":34,"context":{"entity": "[object] (Espo\\Modules\\Voip\\Entities\\VoipRouter: {"id":"5aba1cbc7ce568b36","fields":{"id":{"dbType" :"varchar","len":24,"type":"id"},"name":{"type":"v archar","len":100},"deleted":{"type":"bool","defau lt":false},"externalId":{"type":"varchar","

          Comment


          • #6
            It works fine for my instance. Perhaps something is not installed properly with the permission error. Try to go in Administrator panel > Rebuild.
            Job Offers and Requests

            Comment


            • #7
              tarasm

              I am using VoIP version 1.8.0. I am positive that its not issue from my end. I did clear cache and rebuild.


              PHP Code:
              public function afterSave(Entity $entity)
                  {
                      
              //if (($entity->isFieldChanged('rules') || $entity->isFieldChanged('status')) && $entity->get('status') == 'Active') {
                      
              $additionalNumberTypes = array('sms''mms');
                      
                      
              $connector $entity->get('connector');
                      
              $phoneNumber $entity->get('name');
                      
              $pair $phoneNumber;//$connector . ':' . $phoneNumber;
                      
                      
              if ($entity->get('status') == 'Active') {
                          
              $rules $entity->get('rules', new \StdClass());
                          foreach (
              $rules as $userId => $rule) {  // <----------------------------------------------------failing code
                              
              $user $this->getEntityManager()->getEntity('User'$userId);
                              
              $changedUser false;
                              if (
              $user) {
                                  
                                  
              $additionalNumbers $user->get('voipAdditionalNumbers');
                                  if (empty(
              $additionalNumbers) || !is_object($additionalNumbers)) {
                                      
              $additionalNumbers = new \StdClass();
                                  } 
              Code:
              2018-03-27 11:20:03] Espo.WARNING: E_WARNING: Invalid argument supplied for foreach() {"code":2,"message":"Invalid argument supplied for foreach()","file":"/home/codaxtr_user/projects/unicourt-crm/espocrm/application/Espo/Modules/Voip/Hooks/VoipRouter/UpdateVoipUser.php","line":34,"context":{"entity": "[object] (Espo\\Modules\\Voip\\Entities\\VoipRouter: {"id":"5aba28e3c737bf79c","fields":{"id":{"dbType" :"varchar","len":24,"type":"id"},"name":{"type":"v archar","len":100},"deleted":{"type":"bool","defau lt":false},"externalId":{"type":"varchar","len":10 0},"status":{"type":"varchar","default":"Active"," len":255},"rules":{"type":"jsonObject"},"userOrder ":{"type":"jsonArray","notStorable":true},"voicema ilGreetingText":{"type":"text"},"outgoingRoutes":{ "type":"jsonObject","notStorable":true},"connector ":{"type":"varchar","len":255},"data":{"type":"jso nObject"},"sms":{"type":"bool","notNull":true,"def ault":false},"mms":{"type":"bool","notNull":true," default":false},"voice":{"type":"bool","notNull":t rue,"default":true},"createdAt":{"type":"datetime" ,"notNull":false},"modifiedAt":{"type":"datetime", "notNull":false},"voicemailGreetingFileId":{"dbTyp e":"varchar","len":24,"type":"foreignId","index":f alse,"notNull":false},"voicemailGreetingFileName": {"type":"foreign","relation":"voicemailGreetingFil e","foreign":"name"},"teamId":{"dbType":"varchar", "len":24,"type":"foreignId","index":true,"notNull" :false},"teamName":{"type":"foreign","notStorable" :false,"relation":"team","foreign":"name"},"smsAss ignToId":{"dbType":"varchar","len":24,"type":"fore ignId","index":true,"notNull":false},"smsAssignToN ame":{"type":"foreign","notStorable":false,"relati on":"smsAssignTo","foreign":["firstName"," ","lastName"]},"mmsAssignToId":{"dbType":"varchar","len":24,"ty pe":"foreignId","index":true,"notNull":false},"mms AssignToName":{"type":"foreign","notStorable":fals e,"relation":"mmsAssignTo","foreign":["firstName"," ","lastName"]},"callAssignToId":{"dbType":"varchar","len":24,"t ype":"foreignId","index":true,"notNull":false},"ca llAssignToName":{"type":"foreign","notStorable":fa lse,"relation":"callAssignTo","foreign":["firstName"," ","lastName"]},"createdById":{"dbType":"varchar","len":24,"type ":"foreignId","index":true,"notNull":false},"creat edByName":{"type":"foreign","notStorable":false,"r elation":"createdBy","foreign":["firstName"," ","lastName"]},"modifiedById":{"dbType":"varchar","len":24,"typ e":"foreignId","index":true,"notNull":false},"modi fiedByName":{"type":"foreign","notStorable":false, "relation":"modifiedBy","foreign":["firstName"," ","lastName"]}},"relations":{"voicemailGreetingFile":{"type":"b elongsTo","entity":"Attachment","key":"voicemailGr eetingFileId","foreignKey":"id","foreign":null},"t eam":{"type":"belongsTo","entity":"Team","key":"te amId","foreignKey":"id","foreign":null},"callAssig nTo":{"type":"belongsTo","entity":"User","key":"ca llAssignToId","foreignKey":"id","foreign":null},"m msAssignTo":{"type":"belongsTo","entity":"User","k ey":"mmsAssignToId","foreignKey":"id","foreign":nu ll},"smsAssignTo":{"type":"belongsTo","entity":"Us er","key":"smsAssignToId","foreignKey":"id","forei gn":null},"modifiedBy":{"type":"belongsTo","entity ":"User","key":"modifiedById","foreignKey":"id","f oreign":null},"createdBy":{"type":"belongsTo","ent ity":"User","key":"createdById","foreignKey":"id", "foreign":null}}})","additionalNumberTypes":["sms","mms"],"connector":"Twilio","phoneNumber":"+some-number","pair":"some-number","rules":null}} []
              
              
              [2018-03-27 11:25:04] Espo.WARNING: E_WARNING: Invalid argument supplied for foreach() {"code":2,"message":"Invalid argument supplied for foreach()","file":"/home/codaxtr_user/projects/unicourt-crm/espocrm/application/Espo/Modules/Voip/Hooks/VoipRouter/UpdateVoipUser.php","line":34,"context":{"entity": "[object] (Espo\\Modules\\Voip\\Entities\\VoipRouter: {"id":"5aba2a1098d3dd22f","fields":{"id":{"dbType" :"varchar","len":24,"type":"id"},"name":{"type":"v archar","len":100},"deleted":{"type":"bool","defau lt":false},"externalId":{"type":"varchar","len":10 0},"status":{"type":"varchar","default":"Active"," len":255},"rules":{"type":"jsonObject"},"userOrder ":{"type":"jsonArray","notStorable":true},"voicema ilGreetingText":{"type":"text"},"outgoingRoutes":{ "type":"jsonObject","notStorable":true},"connector ":{"type":"varchar","len":255},"data":{"type":"jso nObject"},"sms":{"type":"bool","notNull":true,"def ault":false},"mms":{"type":"bool","notNull":true," default":false},"voice":{"type":"bool","notNull":t rue,"default":true},"createdAt":{"type":"datetime" ,"notNull":false},"modifiedAt":{"type":"datetime", "notNull":false},"voicemailGreetingFileId":{"dbTyp e":"varchar","len":24,"type":"foreignId","index":f alse,"notNull":false},"voicemailGreetingFileName": {"type":"foreign","relation":"voicemailGreetingFil e","foreign":"name"},"teamId":{"dbType":"varchar", "len":24,"type":"foreignId","index":true,"notNull" :false},"teamName":{"type":"foreign","notStorable" :false,"relation":"team","foreign":"name"},"smsAss ignToId":{"dbType":"varchar","len":24,"type":"fore ignId","index":true,"notNull":false},"smsAssignToN ame":{"type":"foreign","notStorable":false,"relati on":"smsAssignTo","foreign":["firstName"," ","lastName"]},"mmsAssignToId":{"dbType":"varchar","len":24,"ty pe":"foreignId","index":true,"notNull":false},"mms AssignToName":{"type":"foreign","notStorable":fals e,"relation":"mmsAssignTo","foreign":["firstName"," ","lastName"]},"callAssignToId":{"dbType":"varchar","len":24,"t ype":"foreignId","index":true,"notNull":false},"ca llAssignToName":{"type":"foreign","notStorable":fa lse,"relation":"callAssignTo","foreign":["firstName"," ","lastName"]},"createdById":{"dbType":"varchar","len":24,"type ":"foreignId","index":true,"notNull":false},"creat edByName":{"type":"foreign","notStorable":false,"r elation":"createdBy","foreign":["firstName"," ","lastName"]},"modifiedById":{"dbType":"varchar","len":24,"typ e":"foreignId","index":true,"notNull":false},"modi fiedByName":{"type":"foreign","notStorable":false, "relation":"modifiedBy","foreign":["firstName"," ","lastName"]}},"relations":{"voicemailGreetingFile":{"type":"b elongsTo","entity":"Attachment","key":"voicemailGr eetingFileId","foreignKey":"id","foreign":null},"t eam":{"type":"belongsTo","entity":"Team","key":"te amId","foreignKey":"id","foreign":null},"callAssig nTo":{"type":"belongsTo","entity":"User","key":"ca llAssignToId","foreignKey":"id","foreign":null},"m msAssignTo":{"type":"belongsTo","entity":"User","k ey":"mmsAssignToId","foreignKey":"id","foreign":nu ll},"smsAssignTo":{"type":"belongsTo","entity":"Us er","key":"smsAssignToId","foreignKey":"id","forei gn":null},"modifiedBy":{"type":"belongsTo","entity ":"User","key":"modifiedById","foreignKey":"id","f oreign":null},"createdBy":{"type":"belongsTo","ent ity":"User","key":"createdById","foreignKey":"id", "foreign":null}}})","additionalNumberTypes":["sms","mms"],"connector":"Twilio","phoneNumber":"+some-number","pair":"+some-number","rules":null}} []
              Last edited by theBuzzyCoder; 03-27-2018, 11:29 AM.

              Comment


              • rabii
                rabii commented
                Editing a comment
                Hey @theBuzzyCoder

                did you manage to integrate the twilio services after all?

                i want to buy the package mainly to use Twilio services. could not find any info out there, any feedback would help

                Thanks

              • theBuzzyCoder
                theBuzzyCoder commented
                Editing a comment
                Hi @rabii

                Yes. I was able to integrate with Twilio services successfully later on.

              • rabii
                rabii commented
                Editing a comment
                hey theBuzzyCoder,

                Glad you could set it up with twilio.

                i was wondering if you could share how you did it, i am still confused on how to get it done from scratch.

                Questions : When using twilio, did you use the sip or just normal HTTP Request to make outbound and inbound calls ?

                Any help would be much appreciated
            Working...
            X