Table Of Content

Plugin callerid

Purpose

The callerid plugin detects when an incoming call happens with a home phone. It needs a modem to be used.

Dependencies

  • Python dependancy : pyserial (installed with Domogik)

Plug the modem

_images/howtoplug.png

Just plug the modem on a telephony plug and on the server.

Create an udev rule

You may create a udev rule for this device. You can find sample udev rules in the udev/ folder of this plugin.

You just need to copy the choosen sample file in the folder /etc/udev/rules.d/ and unplug/plug the modem.

Plugin configuration

You can configure the url of an online CardDAV file or the path on your server of a CardDAV file. (also called VCF file). These files are contact list files and can be provided by personnal or profesionnal cloud solutions. You can also get this kind of files by doing an export of your smartphone contacts in a file.

Key Type Description
vcf_url url The url of a vcf file or the local path of the file on the server.
vcf_cell_label string Label to override the default number type in the VCF file : ‘CELL’
vcf_home_label string Label to override the default number type in the VCF file : ‘HOME’
vcf_work_label string Label to override the default number type in the VCF file : ‘WORK’

As a VCF fiel can contains multiple numbers for a contact, if a contact have several phone numbers, the type of number will be added to the contact name. Default number types in a VCF file are not sexy (CELL, WORK, HOME):

FN:John doe
TEL;CELL:+33662345678
TEL;WORK:+33222345678

You can override these labels with the vcf_xxxx_label parameters.

Create the domogik devices

Domogik device type : callerid.callerid

Two parameters are needed for a domogik device creation:

Key Type Description
device string The modem device address on the server. Example : /dev/modem
cid_command choice The AT command to activate caller id feature on the modem

If your modem is not able to catch the inbound calls numbers, this may be related to the cid_command parameter. The default value should be ok for most of the modem, but you can try the other values if needed.

Advanced configuration

In the advanced configuration pages, you can configure a list of known conttacts and a list of numbers to blacklist.

Known contacts

Create a line per phone number. The format is : name of the contact;phone number. Example:

John Doe;+33123456789
Daddy;+33987654321

Theses contacts are stored in the file data/contacts.csv in the plugin folder.

Blacklisted numbers

The plugin is able to take the phone up and down for a list of numbers. For these numbers, your phone should ring only once.

Create a line per phone number to blacklist. The format is : reason of the blacklisting;phone number. Example:

I don't like this person;+33666666666
Mother in law;+33555555555

Theses blacklisted numbers are stored in the file data/blacklist.csv in the plugin folder.

Start the plugin

You can now start the plugin (start button) and use the created domogik devices.

Set up your widgets on the user interface

You can now place the widgets of your devices features on the user interface.

Asterisk usage

You can use this plugin with your existing Asterisk installation.

You need to :

For exemple on two separatated machine one running asterisk that can ssh without password to one running domogik

in your asterisk/extensions.conf in the inbound call: [from-pstn] exten => s,1,Gosub(prevenir,s,1)

and add a new sub prevenir like this one:

[prevenir] exten => s,1,Wait(0) same => n, System(nohup ssh domogik@domogikIP ‘python /path/to/your/domogik/bin/send.py xpl-trig cid.basic “calltype=inbound,phone=${CALLERID(num)}”’ &) same => n, Return

Development informations

The command part (blacklist a number) is only done over MQ.

The sensor part (calls detection) is only done over xPL to allow Asterisk usage.

xPL messages

xpl-trig

The cid.basic message is used and extended for our purpose.

xpl-trig
{
...
}
cid.basic
{
calltype=inbound
phone=<phone number>
cln=<contact name>
blacklisted=<yes or no>
}

xpl-stat

n/a

xpl-cmnd

n/a

Changelog

1.3

  • If a caller name is unknown, the value will now be set to the phone number instead of an empty value
  • Butler : improvments in sentences (fr_FR)

1.2

  • WARNING : Domogik 0.5.2 at least is needed.
  • Butler : add compatibility for Domogik 0.5.2
  • Allow the plugin to load a local VCF file (only url in the previous release)

1.1

  • Various minor improvments

1.0

  • Plugin creation