### Description
On creating dispatcher with `kamctl` in the case of `db_text` it fails
### Troubleshooting
#### Reproduction
Point `kamctlrc` to DB_TEXT.
Run `kamctl dispatcher add 1 sip:asterisk_2:5060 1 3` Run 'kamctl dispatcher add 1 sip:asterisk_2:5060 1 3 'prefix=123' 'test1'' Run 'kamctl dispatcher show' Run 'kamctl dispatcher reload'
#### Debugging Data
``` # kamctl dispatcher add 1 sip:asterisk_2:5060 1 3 attrs cannot be empty or null -e \E[37;31mERROR: dispatcher - SQL Error ```
``` # kamctl dispatcher add 1 sip:asterisk_2:5060 1 3 'prefix=123' 'test1' Traceback (most recent call last): File "/usr/lib/x86_64-linux-gnu/kamailio//kamctl/dbtextdb/dbtextdb.py", line 1243, in <module> main(sys.argv) File "/usr/lib/x86_64-linux-gnu/kamailio//kamctl/dbtextdb/dbtextdb.py", line 1230, in main dataset = conn.Execute(' '.join(argv[1:])) File "/usr/lib/x86_64-linux-gnu/kamailio//kamctl/dbtextdb/dbtextdb.py", line 423, in Execute self.WriteTempTable() File "/usr/lib/x86_64-linux-gnu/kamailio//kamctl/dbtextdb/dbtextdb.py", line 1138, in WriteTempTable self.temp_file.write(header.strip() + '\n') File "/usr/lib/python3.7/tempfile.py", line 620, in func_wrapper return func(*args, **kwargs) TypeError: a bytes-like object is required, not 'str' -e \E[37;31mERROR: dispatcher - SQL Error ```
dump is showing active dispatchers, show - is not. ``` # kamctl dispatcher dump { "jsonrpc": "2.0", "result": { "NRSETS": 1, "RECORDS": [{ "SET": { "ID": 1, "TARGETS": [{ "DEST": { "URI": "sip:asterisk_2:5060", "FLAGS": "AP", "PRIORITY": 0 } }] } }] }, "id": 124 } root@e529c8cb4f62:/# kamctl dispatcher show -e dispatcher gateways ```
No result on reload ``` # kamctl dispatcher reload { "jsonrpc": "2.0", "result": { }, "id": 160 } ```
### Possible Solutions
I've tried to add data to the table manually, but here I got another issue.
But on Kamailio load, the only first dispatcher is processed. Will add another issue on this.
### Additional Information
* **Kamailio Version** - output of `kamailio -v`
``` /# kamailio -v version: kamailio 5.4.1 (x86_64/linux) flags: USE_TCP, USE_TLS, USE_SCTP, TLS_HOOKS, USE_RAW_SOCKS, DISABLE_NAGLE, USE_MCAST, DNS_IP_HACK, SHM_MMAP, PKG_MALLOC, Q_MALLOC, F_MALLOC, TLSF_MALLOC, DBG_SR_MEMORY, USE_FUTEX, FAST_LOCK-ADAPTIVE_WAIT, USE_DNS_CACHE, USE_DNS_FAILOVER, USE_NAPTR, USE_DST_BLACKLIST, HAVE_RESOLV_RES, TLS_PTHREAD_MUTEX_SHARED ADAPTIVE_WAIT_LOOPS 1024, MAX_RECV_BUFFER_SIZE 262144, MAX_URI_SIZE 1024, BUF_SIZE 65535, DEFAULT PKG_SIZE 8MB poll method support: poll, epoll_lt, epoll_et, sigio_rt, select. id: unknown compiled with gcc 8.3.0 ```
* **Operating System**:
Debian 10/Docker
``` # uname -a Linux 9b7efa852274 5.3.18-lp152.36-default #1 SMP Tue Aug 18 17:09:44 UTC 2020 (885251f) x86_64 GNU/Linux ```
The python script used by kamctl to manage dbtext records is not maintained for long time, I do not even recall who contributed it. If someone wants to take over its maintenance and bring it up to work with python3 and current kamailio, then it will stay, otherwise it will be removed. You have to do manual management of dbtext files.
Not being specific to dispatcher, but the python tool behind the kamctl db_text operations, I am closing this one in favour of #2469.
Closed #2464.
This solution [2469#issuecomment-1164490679](https://github.com/kamailio/kamailio/issues/2469#issuecomment-1164490679) may be useful.