Jump to content

Welcome to Smart Home Forum by FIBARO

Dear Guest,

 

as you can notice parts of Smart Home Forum by FIBARO is not available for you. You have to register in order to view all content and post in our community. Don't worry! Registration is a simple free process that requires minimal information for you to sign up. Become a part of of Smart Home Forum by FIBARO by creating an account.

 

As a member you can:

  •     Start new topics and reply to others
  •     Follow topics and users to get email updates
  •     Get your own profile page and make new friends
  •     Send personal messages
  •     ... and learn a lot about our system!

 

Regards,

Smart Home Forum by FIBARO Team


HC2 and FreePBX last caller info. Got it working :-)


Recommended Posts

  • Topic Author
  • Posted

    The request part was more a joke

    Please login or register to see this image.

    /emoticons/default_icon_smile.gif" alt=":-)" />

     

    Anyway... Here we go.

     

    1 -  Replace the pushnumber.php in  /var/www/html with the following code (change password, username abd HC2serverIP accordingly):

    (Note: You can create this file on any server, as long as it's accessible by Caller ID Superfecta.)

    Please login or register to see this code.

    The above PHP code will push the Name, number and a trigger (1) to HC2 and populate 3 variables named LastCall_NR, LastCall_Name and LastCall_Push.

     

    2 - Create the following variables in HC2 (Panels > Variables Panel): LastCall_NR, LastCall_Name and LastCall_Push. Leave the values set to 0

     

    3 - Create a LUA Scene and add the following code to it:

    Please login or register to see this code.

    The above scene code will send a popup to all registered mobile devices with the callers name (if found in the FreePBX phone book) and number.

     

    3 - Create a VD with 2 labels. Call one label Number, and give it ID number. Call the 2nd label: Name, and give it ID name.

    Add the following code in the Main loop. (Make sure you set the 172 to the correct VD ID number and the sceneID 105 to the number of the scene you created in step 2)

    Please login or register to see this code.

    The above VD code will check ever 15 seconds and set the variables LastCall_NR and LastCall_Name in your VD. it will also check if "LastCall_push" is set to 1. If so, it will set LastCall_push to 0, and call (activate) the scene with ID sceneID (popup scene)

     

    4 - Now go to Caller ID Superfecta (in FreePBX).

    • Enable: Asterisk Phonebook
    • Enable: Send to URL and set it to

    Please login or register to see this code.

    (Make sure that you set the IP to the server you are running pushnumber.php script on)

    • Enable: Abandon lookup

    Make sure that you set Asterisk Phonebook as 1st action!

     

    Done....
     

    Posted

    Guest et al.,

     

    I tested your last solution. It is working fine.

     

    One minor bug :

     

    In your scene there is missing apostrophe after the word Telephone. The line should be :

     

        title = 'Telephone',
        
     
    I still did not like that a VD is active constantly with sleep interval. 
     
    I would rather have scene triggered by change of the global variable LastCall_Push.
    The VD would just display the value of the global variables or it could be skipped.
     
    I worked a little to modify the scene but it was not triggered - the global variables were properly updated by Asterisk.
     
    I found the comment in the LUA programing guide shared by Traktor69 on Polish Fibaro forum that the scene can be triggered by the change of the global variable but this mechanism works only if the global variable is changed by another scene. It is not working if the global variable is updated manually - which is our case.
     
    At the end I went back to your recent idea.
     
    Anyway thank you Guest very much for your input. 
  • Topic Author
  • Posted

    Thank you for pointing out the error in the script. I think this might have happened when I was doing some "online" translating of the variable

    Please login or register to see this image.

    /emoticons/default_icon_smile.gif" alt=":-)" />

     

    re: I still did not like that a VD is active constantly with sleep interval.

     

    You can create a scene to monitor variable "LastCall_Push", and get it to trigger the VD, or add some code to  pushnumber.php to activate a scene through sceneControl

    • 2 months later...
    Posted

    hmm,

    for some reason the number does not get pushed into my variable, when a call comes in. However in debug in superfecta the number gets properly pushed... do you have a hint?

    Posted

    hmm,

    for some reason the number does not get pushed into my variable, when a call comes in. However in debug in superfecta the number gets properly pushed... do you have a hint?

    got it working, you need to activate superfeca in the extension.... (d'oh)m

    Please login or register to see this image.

    /emoticons/default_biggrin.png" alt=":D" srcset="https://forum.fibaro.com/uploads/emoticons/[email protected] 2x" width="20" height="20" />

     

    do you think it is possible to get retrieve call information directly e.g. to take actions? I am thinking about " when someone calls, mute sonos and... "

     

    cheers

    joystick

  • Topic Author
  • Posted

    I guess that you could compare LastCall_NR with a predefined phone number in a scene and make it do things.

     

    something like this (not tested):

    Please login or register to see this code.

    Posted

     

    I guess that you could compare LastCall_NR with a predefined phone number in a scene and make it do things.

     

    something like this (not tested):

    Please login or register to see this code.

     

    yes, I was thinking about something similar, I did not have the time to test it, yet. My question actually was, if the numer is already pushed, on "first" ringtone or similar, meaning quite neartime?

  • Topic Author
  • Posted (edited)

    I've HC2 to announce the caller as soon as a ring is received (like above code)

    For all known callers I have a predefined MP3 with the callers name.

     

    It is instantly!

    Edited by Guest
    • 2 weeks later...
  • Topic Author
  • Posted

    I've now updated the pushnumber.php script to also start a LUA script when the variable LastCall_NR or LastCall_Name are changed.

    Please login or register to see this code.

    LUA code example. (will trigger when variable LastCall_Name is changed.)

    Please login or register to see this code.

    ...

    • 1 year later...
    Guest Robertos80
    Posted (edited)

    Hi.

     

    What you have both done looks very good and useful. 

    Anyway, I couldn’t manage to push/ send caller numbers from Pbx to variable in Fibaro. The first solution with number.php works just find but I really would like to have push send just after nr will change. 

    Looks like php script couldn’t change any variable in HC2. UPDATE: OK I got it @=%40.

    i assume videodomophone is connected to PBX and superfecta is sending number via http ?

     

    Update:

    It works! (if no entries are in Pbx phonebook).

     

     

    Edited by Robertos80

    Join the conversation

    You can post now and register later. If you have an account, sign in now to post with your account.

    Guest
    Reply to this topic...

    ×   Pasted as rich text.   Paste as plain text instead

      Only 75 emoji are allowed.

    ×   Your link has been automatically embedded.   Display as a link instead

    ×   Your previous content has been restored.   Clear editor

    ×   You cannot paste images directly. Upload or insert images from URL.

    ×
    ×
    • Create New...