# Writing the call-sign DB

The command line interface also allows to write a call-sign DB (also known as Talker Alias) to the radio if the radio supports it. This can be done with the `write-db` command. This command behaves similar to the call-sign DB upload in qdmr. That is, it tries to select the call-signs being written automatically.

Although many radios provide a huge amount of memory for the call-sign DB, they cannot hold the entire list of assigned DMR IDs. Therefore, a selection of relevant call-signs must be done. qdmr and `dmrconf` do that based on the DMR ID of the radio. DMR IDs are not random. They follow a pattern similar to land-line phone numbers. DMR IDs within a certain continent, country and region share a common prefix. This way, it is possible to select DMR IDs that are close by selecting IDs that share a common prefix.

qdmr and `dmrconf` use the default DMR ID of the radio to select the call-signs to be written. This ID is obtained by qdmr from the codeplug. `dmrconf` does not require a codeplug to be present for the upload. Consequently, it requires the explicit specification of the ID to base the selection on. The ID can be specified using the `--id` or `-I` options. It is also possible to just specify the prefix instead of an ID.

    dmrconf write-db --id=2621

This example writes a call-sign DB to the connected radio using the DMR prefix 2621 (for the region Berlin/Brandenburg in Germany). The radio will fill the available space with as many call-signs as possible. So for the previous example, `dmrconf` will not only program all IDs with the prefix 2621 but as many as possible starting with those close to that prefix. It is possible to limit the number of call-signs encoded using the `--limit` or `-n` option.

Unfortunately, there is always an exception to a rule: Some countries have several prefixes or you may program the call-signs of several countries that are not necessarily close in terms of their prefixes. For these cases, it is possible to specify a list of prefixes to the `--id` option.

    dmrconf write-db --id=262,263 --limit=10000

This example will select and write up to 10000 (given the radio can hold that amount) call-signs staring with those closest to the prefixes 262 and 263 (both prefixes for Germany).

With version 0.11.3, it is possible, to specify a user-crafted JSON database. Then, this file will be used for selecting the call signs for writing the call-sign DB.

    dmrconf write-db --id=262 --limit=10000 --database=my_db.json

Here, up to 10000 call signs are written from the `my_db.json` JSON file starting with those IDs closest to the prefix 262. Specifying a user-curated call-sign DB, simply replaces the public one and thus all methods described above still work.

Like for the binary codeplug, it is also possible to generate and store the binary representation of the call-sign DB using the `encode-db` command. This command is only useful for debugging purposes as the binary representation of the call-sign DB cannot be written to the device.

The `encode-db` takes the same arguments as the `write-db` command but additionally needs a filename to store the encoded DB into as well as the radio to encode for using the `--radio` option.

    dmrconf encode-db --radio=d878uv --id=262,263 --limit=10000 callsigns.dfu

Like the previous example, this one encodes up to 10000 call-signs starting with those closest to the prefixes 262 and 263 for a AnyTone AT-D878UV radio and stores the result into `callsigns.dfu`.