Menu

Run a prog if not blacklist call

Alex
2016-12-07
2016-12-10
  • Alex

    Alex - 2016-12-07

    Hello everyone
    I'm new with NCID and I think it's a great program.
    I use it with a raspberry pi against telemarketing.
    I would like to switch the rpi gpio only if a call is not in blacklist.
    It is possible ? what is the way to do this?
    For swith the gpio i can use a .sh in "/usr/share/ncid/modules"
    run with "ncid --no-gui --program ncid-switch_gpio"
    ...
    If someone can help me thanks in advance

     

    Last edit: Alex 2016-12-07
  • John L. Chmielewski

    Hi Alex,

    The ncid server creates various call types. If you configure the module for type CID, it will
    not pass calls in the blacklist if the ncidd hangup option is enabled.

    Look at /etc/ncid/conf.d/ncid-skel.conf for the list of call and message types. You can
    select the type or types to process. The /usr/share/ncid/modules/ncid-skel module is intended to help users write a client module. The comments should tell you which lines of code to delete and which to replace.

     
  • Alex

    Alex - 2016-12-07

    Thanks for your quick reply, I look at this

     
  • Alex

    Alex - 2016-12-08

    ok that's work, i can run a .sh with a no blacklist call.
    But the prog can't controling the gpio without starting by "sudo"...
    You know a solution for this?
    Thank for your help.

     
  • Laurent Boucher

    Laurent Boucher - 2016-12-08

    Hello Alex,
    maybe with the setuid bit ?
    https://en.wikipedia.org/wiki/Setuid

     
    • John L. Chmielewski

      Hi Laurent,

      The setuid bit does not work on scripts, it would need to be set on the shell which would mean the shell would run as root for everyone. Thanks for bringing it up so I can explain the setuid only works on binaries, not scripts.

       
      • Laurent Boucher

        Laurent Boucher - 2016-12-09

        Hi John, OK thank you, I didn't knew that.

         
  • John L. Chmielewski

    Hi Alex,

    If you start ncid with the output module by hand, you need to use sudo. If you create an init script for it, then it will be run as root when the RPi boots.

    You can copy and rename the /etc/init.d/ncid-page script. Modify the copy to start your module.

    Review the AUTOSTART section in the Raspbian Install in the user manual.

     
  • Alex

    Alex - 2016-12-08

    Thank you, i try this

     
  • Alex

    Alex - 2016-12-09

    Ok it's great, everything goes very well with your explanations.
    Thanks you!! Now i have a block-phone system with activation of the ring if call out blacklist !!
    Thank you very much john.

     
  • Todd Andrews

    Todd Andrews - 2016-12-09

    Hi Alex,

    Brilliant! You've described a very clever solution to a problem we're often asked about -- how to suppress the normal first ring on blacklisted callers.

    Would you mind sharing your hardware and script solution? I'm sure other NCID users would want to know the details of how you did this. We already have a place where you could post your info: Useful -Scripts.

     
  • Alex

    Alex - 2016-12-10

    Hello, ok no problem, i have make a tuto but in french...
    I translate it and I post it this week end, with drawings fritzing for hardware.

     
  • Alex

    Alex - 2016-12-10
     

    Last edit: Alex 2016-12-10
  • eikaff

    eikaff - 2016-12-10

    I think that you can implement different and probably better solution. Your scheme prevents one phone to ring. Think about using the relay (GPIO controlled) to cut off the phone line. In this way you can prevent every connected phone to ring(i.e. Analog PBX).

    You should just try. :)

    Regards.

     

    Last edit: eikaff 2016-12-10
  • Alex

    Alex - 2016-12-10

    Yes it's a good idea...
    Thank you.
    But you have to reconnect the line to be able to call?

     

Log in to post a comment.