npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

@scrypted/bticino

v0.0.18

Published

The C300X Plugin for Scrypted allows viewing your C300X intercom with incoming video/audio.

Downloads

17

Readme

BTicino Intercom Plugin for Scrypted

The C300X Plugin for Scrypted allows viewing your C300X intercom with incoming video/audio.

WARNING: You will need access to the device, see https://github.com/fquinto/bticinoClasse300x.

You also need the c300x-controller and node (v17.9.1) running on your device which will expose an API for the intercom.

Development instructions

$ cd plugins/sip
$ npm ci
$ cd plugins/bticino
$ npm ci
$ npm run build
$ num run scrypted-deploy 127.0.0.1

After flashing a custom firmware you must at least:

  • Install node on your device and run the c300x-controller on the device
  • Install /lib/libatomic.so.1 in /lib
  • Allow access to the SIP server on port 5060
  • Allow your IP to authenticated with the SIP server
  • Add a SIP user for scrypted

To do this use the guide below:

Installing node and c300x-controller

$ cd /home/bticino/cfg/extra/
$ mkdir node
$ cd node
$ wget https://nodejs.org/download/release/latest-v17.x/node-v17.9.1-linux-armv7l.tar.gz
$ tar xvfz node-v17.9.1-linux-armv7l.tar.gz

Node will require libatomic.so.1 which isn't shipped with the device, get the .deb file from http://ftp.de.debian.org/debian/pool/main/g/gcc-10-cross/libatomic1-armhf-cross_10.2.1-6cross1_all.deb

$ ar x libatomic1-armhf-cross_10.2.1-6cross1_all.deb 

scp the libatomic.so.1 to /lib and check that node works:

$ root@C3X-00-00-00-00-00--2222222:~# /home/bticino/cfg/extra/node/bin/node -v
v17.9.1

Make flexisip listen on a reachable IP and add users to it

To be able to talk to our own SIP server, we need to make the SIP server on the C300X talk to our internal network, instead of only locally (on the lo interface).

Mount the root system read-write

$ mount -oremount,rw /

Change the listening ports by appending some arguments in /etc/init.d/flexisipsh

(look at the end of the line, change to the IP of your C300X)

case "$1" in
  start)
    start-stop-daemon --start --quiet --exec $DAEMON -- $DAEMON_ARGS --transports "sips:$2:5061;maddr=$2;require-peer-certificate=1 sip:127.0.0.1;maddr=127.0.0.1 sip:192.168.0.XX;maddr=192.168.0.XX"
;;

You can also change it to - $2, the script will then put in the current wifi IP.

start-stop-daemon --start --quiet --exec $DAEMON -- $DAEMON_ARGS --transports "sips:$2:5061;maddr=$2;require-peer-certificate=1 sip:127.0.0.1;maddr=127.0.0.1 sip:$2;maddr=$2"

The intercom is firewalled, the easiest way is to remove the firewall file (or move it to somewhere on /home/bticino/cfg/extra which is a kind of permanent storage)

If you don't want to do that yet, drop the firewall rules from command line: (IMPORTANT: needs to be repeated after each reboot)

iptables -P INPUT ACCEPT
iptables -P FORWARD ACCEPT
iptables -P OUTPUT ACCEPT

If you are sick of repeating these commands every time you reboot:

mv /etc/network/if-pre-up.d/iptables /home/bticino/cfg/extra/iptables.bak
mv /etc/network/if-pre-up.d/iptables6 /home/bticino/cfg/extra/iptables6.bak

Edit the /home/bticino/cfg/flexisip.conf so baresip can authenticate with it.

Set log-level and syslog-level to debug (it logs to /var/log/log_rotation.log)

In trusted-hosts add the IP address of the server where you will run baresip. This makes sure we don’t need to bother with the initial authentication of username/password.

Hosts in trusted-hosts can register without needing to authenticate.

[global]
...
log-level=debug
syslog-level=debug

[module::Authentication]
enabled=true
auth-domains=c300x.bs.iotleg.com
db-implementation=file
datasource=/etc/flexisip/users/users.db.txt
trusted-hosts=127.0.0.1 192.168.0.XX
hashed-passwords=true
reject-wrong-client-certificates=true

Now we will add a user agent (user) that will be used by scrypted to register itself with flexisip

Edit the /etc/flexisip/users/users.db.txt file and create a new line by copy/pasting the c300x user.

For example:

[email protected] md5:ffffffffffffffffffffffffffffffff ;
[email protected] md5:ffffffffffffffffffffffffffffffff ;

Leave the md5 as the same value - I use fffff.... just for this example.

Edit the /etc/flexisip/users/route.conf file and add a new line to it, it specifies where this user can be found on the network. Change the IP address to the place where you will run baresip (same as trusted-hosts above)

<sip:[email protected]> <sip:192.168.0.XX>

Edit the /etc/flexisip/users/route_int.conf file.

This file contains one line that starts with <sip:alluser@... it specifies who will be called when someone rings the doorbell.

You can look at it as a group of users that is called when you call [email protected]

Add your username at the end (make sure you stay on the same line, NOT a new line!)

<sip:[email protected]> ..., <sip:[email protected]>

Reboot and verify flexisip is listening on the new IP address.

~# ps aux|grep flexis
bticino    741  0.0  0.3   9732  1988 ?        SNs  Oct28   0:00 /usr/bin/flexisip --daemon --syslog --pidfile /var/run/flexisip.pid --p12-passphrase-file /var/tmp/bt_answering_machine.fifo --transports sips:192.168.0.XX:5061;maddr=192.168.0.XX;require-peer-certificate=1 sip:127.0.0.1;maddr=127.0.0.1  sip:192.168.0.XX;maddr=192.168.0.XX
bticino    742  0.1  1.6  45684  8408 ?        SNl  Oct28   1:44 /usr/bin/flexisip --daemon --syslog --pidfile /var/run/flexisip.pid --p12-passphrase-file /var/tmp/bt_answering_machine.fifo --transports sips:192.168.0.XX:5061;maddr=192.168.0.XX;require-peer-certificate=1 sip:127.0.0.1;maddr=127.0.0.1  sip:192.168.0.XX;maddr=192.168.0.XX