Http and 3cx

Discussion in 'CRM / Helpdesk / App Integration' started by Fabione, Mar 2, 2017.

Thread Status:
Not open for further replies.
  1. Fabione

    Joined:
    Feb 25, 2017
    Messages:
    14
    Likes Received:
    1
    Hello, I'm new of 3CX and I have a question.

    I have a 3cx pbx and a Door station of Lilin with a relay that open a door.

    It is SIP and the audio/video work good.

    The Lilin door station haven't a dtmf code to open relay but have only a string http to open relay like this:

    Code:
    http://192.168.0.200/setio?relay1=1 and http://192.168.0.200/setio?relay1=0 to stop the opening.
    Is possible to program 3CX to assign a code (for ex: *123) to launch that string ?

    Thanks in advantage and sorry for my bad english.
     
  2. edossantos

    edossantos Support Team
    Staff Member 3CX Support

    Joined:
    Jun 27, 2007
    Messages:
    1,361
    Likes Received:
    109
    Hi @Fabione,

    You can create a VAD application to invoke that HTTP request. Then you call the extension of the VAD app and maybe the app can ask you to enter a DTMF to open or close the door.

    It would be similar to what we show here:
    https://www.3cx.com/blog/docs/accessing-web-service-vad/

    But using a Web Interaction component instead of the Web Services Interaction component.

    Please note that the VAD is available for v14 only now. The Service Pack 6 of v15 will include the VAD for v15.

    Kind regards.
    Ernesto.
     
    Stop hovering to collapse... Click to collapse... Hover to expand... Click to expand...
  3. Fabione

    Joined:
    Feb 25, 2017
    Messages:
    14
    Likes Received:
    1
    2n9et8g.jpg Morning Ernesto, I just installed the VAD for V15.5 and it works good.

    I make a new very basilar project that has two http request:

    Code:
    http://192.168.0.200/setio?relay1=1
    http://192.168.0.200/setio?relay1=0
    It work with a queue exstension but I need to add a delay (4 or 5 seconds) after the first http request, any suggestion ?



    Thank you very much.
     
    #3 Fabione, Jun 12, 2017
    Last edited by a moderator: Jul 28, 2017
  4. edossantos

    edossantos Support Team
    Staff Member 3CX Support

    Joined:
    Jun 27, 2007
    Messages:
    1,361
    Likes Received:
    109
    Hi @Fabione,

    In order to add a delay, you can use a "Launch External Script" component, and use the following C# code for it:
    Code:
    using System;
    using System.Threading;
    
    namespace DelayNamespace
    {
      public class Delay
      {
        public void DelayExecution(int milliseconds)
        {
          Thread.Sleep(milliseconds);
        }
      }
    }
    
    Then you can invoke that code configuring the Launch External Code component as follows:
    upload_2017-6-12_9-31-40.png

    Kind regards.
     
    Stop hovering to collapse... Click to collapse... Hover to expand... Click to expand...
  5. Fabione

    Joined:
    Feb 25, 2017
    Messages:
    14
    Likes Received:
    1
    Thank You Ernesto, I tested it and It works but not everytime, sometime I call the extension and the second http request do not start ...
     
  6. edossantos

    edossantos Support Team
    Staff Member 3CX Support

    Joined:
    Jun 27, 2007
    Messages:
    1,361
    Likes Received:
    109
    Stop hovering to collapse... Click to collapse... Hover to expand... Click to expand...
    Fabione likes this.
  7. Fabione

    Joined:
    Feb 25, 2017
    Messages:
    14
    Likes Received:
    1
    I open the log and I found a banal error on http requests, now everythings is working good !!

    Thank you so much for the rapid and resolutive help !!!! :):):)
     
    #7 Fabione, Jun 12, 2017
    Last edited: Jun 12, 2017
    edossantos likes this.
Thread Status:
Not open for further replies.