Closed zhongdongy closed 4 years ago
hi, @zhongdongy ! How recent is your opensips-cli
? There were several fixes in this area, so I suggest you grab the latest version and retry.
PS: template_url
has been completely removed
OK, I think I understand what's happening. Are you somehow running Python 3.5.x
or below?
Later Edit: it seems not, as you say you're on 3.7... so I don't understand why the standard-create.sql
file doesn't get run first.
Can you paste the output of dpkg -L opensips-mysql-module
, please? Thank you!
hi, @zhongdongy ! How recent is your
opensips-cli
? There were several fixes in this area, so I suggest you grab the latest version and retry.PS:
template_url
has been completely removed
Hi, @liviuchircu ! Thanks for this information. I've retried this on another virtual machine and it works. fine now. But here is something I noticed during the execution:
The opensips-cli
CLI tool just hangs during execution if opensips
service is running in background. I tried to re-install opensips-cli
but this didn't solve the issue. Then I stopped opensips
service and run CLI tool again, it worked!
So I think it works now. And on this VM, I have python3.6 installed for your information.
OK, I think I understand what's happening. Are you somehow running Python
3.5.x
or below?Later Edit: it seems not, as you say you're on 3.7... so I don't understand why the
standard-create.sql
file doesn't get run first.Can you paste the output of
dpkg -L opensips-mysql-module
, please? Thank you!
Thank you @liviuchircu very much for this update. But unfortunately I terminated that specific cloud instance a few days ago so I am unable to provide those information from exact same machine. But with the latest success, I found it works fine with Python 3.6. And here are some related information if it helps:
# opensips-cli --version
OpenSIPS CLI 0.1.0
Built from source:
# opensips -V
version: opensips 3.0.2 (x86_64/linux)
flags: STATS: On, DISABLE_NAGLE, USE_MCAST, SHM_MMAP, PKG_MALLOC, Q_MALLOC, F_MALLOC, HP_MALLOC, DBG_MALLOC, FAST_LOCK-ADAPTIVE_WAIT
ADAPTIVE_WAIT_LOOPS=1024, MAX_RECV_BUFFER_SIZE 262144, MAX_LISTEN 16, MAX_URI_SIZE 1024, BUF_SIZE 65535
poll method support: poll, epoll, sigio_rt, select.
git revision: 7e8167853
main.c compiled on 19:02:48 Apr 2 2020 with gcc 7
# dpkg -L opensips-mysql-module
/.
/usr
/usr/lib
/usr/lib/x86_64-linux-gnu
/usr/lib/x86_64-linux-gnu/opensips
/usr/lib/x86_64-linux-gnu/opensips/modules
/usr/lib/x86_64-linux-gnu/opensips/modules/db_mysql.so
/usr/lib/x86_64-linux-gnu/opensips/opensipsctl
/usr/lib/x86_64-linux-gnu/opensips/opensipsctl/opensipsctl.mysql
/usr/lib/x86_64-linux-gnu/opensips/opensipsctl/opensipsdbctl.mysql
/usr/share
/usr/share/doc
/usr/share/doc/opensips-mysql-module
/usr/share/doc/opensips-mysql-module/README.db_mysql
/usr/share/doc/opensips-mysql-module/copyright
/usr/share/opensips
/usr/share/opensips/mysql
/usr/share/opensips/mysql/acc-create.sql
/usr/share/opensips/mysql/alias_db-create.sql
/usr/share/opensips/mysql/auth_db-create.sql
/usr/share/opensips/mysql/avpops-create.sql
/usr/share/opensips/mysql/b2b-create.sql
/usr/share/opensips/mysql/b2b_sca-create.sql
/usr/share/opensips/mysql/cachedb_sql-create.sql
/usr/share/opensips/mysql/call_center-create.sql
/usr/share/opensips/mysql/carrierroute-create.sql
/usr/share/opensips/mysql/closeddial-create.sql
/usr/share/opensips/mysql/clusterer-create.sql
/usr/share/opensips/mysql/cpl-create.sql
/usr/share/opensips/mysql/dialog-create.sql
/usr/share/opensips/mysql/dialplan-create.sql
/usr/share/opensips/mysql/dispatcher-create.sql
/usr/share/opensips/mysql/domain-create.sql
/usr/share/opensips/mysql/domainpolicy-create.sql
/usr/share/opensips/mysql/drouting-create.sql
/usr/share/opensips/mysql/emergency-create.sql
/usr/share/opensips/mysql/fraud_detection-create.sql
/usr/share/opensips/mysql/group-create.sql
/usr/share/opensips/mysql/imc-create.sql
/usr/share/opensips/mysql/load_balancer-create.sql
/usr/share/opensips/mysql/msilo-create.sql
/usr/share/opensips/mysql/permissions-create.sql
/usr/share/opensips/mysql/presence-create.sql
/usr/share/opensips/mysql/registrant-create.sql
/usr/share/opensips/mysql/registrar-create.sql
/usr/share/opensips/mysql/rls-create.sql
/usr/share/opensips/mysql/rtpproxy-create.sql
/usr/share/opensips/mysql/siptrace-create.sql
/usr/share/opensips/mysql/speeddial-create.sql
/usr/share/opensips/mysql/standard-create.sql
/usr/share/opensips/mysql/tls_mgm-create.sql
/usr/share/opensips/mysql/uri_db-create.sql
/usr/share/opensips/mysql/userblacklist-create.sql
/usr/share/opensips/mysql/usrloc-create.sql
/usr/share/doc/opensips-mysql-module/changelog.Debian.gz
# uname -a
Linux dong 4.15.0-72-generic #81-Ubuntu SMP Tue Nov 26 12:20:02 UTC 2019 x86_64 x86_64 x86_64 GNU/Linux
# python3 --version
Python 3.6.9
The opensips-cli CLI tool just hangs during execution if opensips service is running in background. I tried to re-install opensips-cli but this didn't solve the issue. Then I stopped opensips service and run CLI tool again, it worked!
Interesting - so I guess this is the only problem left. Can you set log_level: DEBUG
in your ~/.opensips-cli.cfg
file, try again and paste the logs? I suspect it's getting stuck while communicating through /tmp/opensips_fifo
, but I can't tell the reason.
PS: Thanks to your report, I pushed a fix for Python 3.5 users as well, so database create
should work fine for them now :)
The opensips-cli CLI tool just hangs during execution if opensips service is running in background. I tried to re-install opensips-cli but this didn't solve the issue. Then I stopped opensips service and run CLI tool again, it worked!
Interesting - so I guess this is the only problem left. Can you set
log_level: DEBUG
in your~/.opensips-cli.cfg
file, try again and paste the logs? I suspect it's getting stuck while communicating through/tmp/opensips_fifo
, but I can't tell the reason.PS: Thanks to your report, I pushed a fix for Python 3.5 users as well, so
database create
should work fine for them now :)
Glad to help! Just now I added log_level=DEBUG
in the opensips-cli.cfg file (mine is under /etc/opensips/opensips-cli.cfg
) and tried to run opensips-cli -x database create
. Here is the output:
# opensips-cli -x database create
DEBUG: Loaded module 'database'
DEBUG: Loaded module 'diagnose'
DEBUG: Loaded module 'instance'
DEBUG: Loaded module 'mi'
DEBUG: sent command ':opensips_fifo_reply_4438:{"jsonrpc": "2.0", "id": "30125", "method": "which", "params": []}'
And I also tried other commands, similar output here:
# opensips-cli # No other arguments given here
DEBUG: Loaded module 'database'
DEBUG: Loaded module 'diagnose'
DEBUG: Loaded module 'instance'
DEBUG: Loaded module 'mi'
DEBUG: sent command ':opensips_fifo_reply_32218:{"jsonrpc": "2.0", "id": "18183", "method": "which", "params": []}'
So I think you are right, it stuck when communicating throught /tmp/opensips_fifo
.
And just for your information, I also tried to add new domain via OpenSIPS control panel but failed. Do you think this can also because the MI interfaces stuck?
Are you sure you have loaded the mi_fifo.so
module? Maybe you have some old /tmp/opensips_fifo
file -- could be a theory
And just for your information, I also tried to add new domain via OpenSIPS control panel but failed. Do you think this can also because the MI interfaces stuck?
Yes, could be the same problem. After adding a new domain, the CP will reload the domains by writing ... domain_reload ...
to /tmp/opensips_fifo
, then waiting for a reply.
Are you sure you have loaded the
mi_fifo.so
module? Maybe you have some old/tmp/opensips_fifo
file -- could be a theory
Just now I checked my /etc/opensips/opensips.cfg
file and the mi_fifo.so
module is in the config and not commented. And the /tmp/opensips_fifo
file is most recent (I deleted the old one and created again) but the opensips-cli
still stuck at the same place.
# cat /etc/opensips/opensips.cfg | grep mi_fifo.so
loadmodule "mi_fifo.so"
# rm /tmp/opensips_fifo
# systemctl restart opensips
# ls /tmp/opensips_fifo -l
prw-rw-rw- 1 opensips opensips 0 Apr 3 15:57 /tmp/opensips_fifo
# opensips-cli
Welcome to OpenSIPS Command Line Interface!
DEBUG: Loaded module 'database'
DEBUG: Loaded module 'diagnose'
DEBUG: Loaded module 'instance'
DEBUG: Loaded module 'mi'
DEBUG: sent command ':opensips_fifo_reply_4488:{"jsonrpc": "2.0", "id": "28611", "method": "which", "params": []}'
^CTraceback (most recent call last):
File "/usr/local/bin/opensips-cli", line 4, in <module>
__import__('pkg_resources').run_script('opensipscli==0.1.0', 'opensips-cli')
File "/usr/lib/python3/dist-packages/pkg_resources/__init__.py", line 658, in run_script
self.require(requires)[0].run_script(script_name, ns)
File "/usr/lib/python3/dist-packages/pkg_resources/__init__.py", line 1438, in run_script
exec(code, namespace, namespace)
File "/usr/local/lib/python3.6/dist-packages/opensipscli-0.1.0-py3.6.egg/EGG-INFO/scripts/opensips-cli", line 9, in <module>
run_console()
File "/usr/local/lib/python3.6/dist-packages/opensipscli-0.1.0-py3.6.egg/EGG-INFO/scripts/opensips-cli", line 6, in run_console
main.main()
File "/usr/local/lib/python3.6/dist-packages/opensipscli-0.1.0-py3.6.egg/opensipscli/main.py", line 77, in main
shell = cli.OpenSIPSCLIShell(args)
File "/usr/local/lib/python3.6/dist-packages/opensipscli-0.1.0-py3.6.egg/opensipscli/cli.py", line 84, in __init__
self.update_instance(cfg.current_instance)
File "/usr/local/lib/python3.6/dist-packages/opensipscli-0.1.0-py3.6.egg/opensipscli/cli.py", line 159, in update_instance
self.modules[name] = (imod, mod.__get_methods__(imod))
File "/usr/local/lib/python3.6/dist-packages/opensipscli-0.1.0-py3.6.egg/opensipscli/modules/mi.py", line 181, in __get_methods__
return comm.execute('which')
File "/usr/local/lib/python3.6/dist-packages/opensipscli-0.1.0-py3.6.egg/opensipscli/comm.py", line 40, in execute
ret = comm_handler.execute(cmd, params)
File "/usr/local/lib/python3.6/dist-packages/opensipscli-0.1.0-py3.6.egg/opensipscli/communication/fifo.py", line 63, in execute
with open(reply_fifo_file, 'r') as reply_fifo:
KeyboardInterrupt
Wait - are you sure that systemctl restart opensips
doesn't start some OpenSIPS 2.4
package that's also installed on the system? It really looks like you're starting a 2.4
version, since it cannot process the /tmp/opensips_fifo
data...
Wait - are you sure that
systemctl restart opensips
doesn't start some OpenSIPS2.4
package that's also installed on the system? It really looks like you're starting a2.4
version, since it cannot process the/tmp/opensips_fifo
data...
Oh no!! Indeed, the opensips has a version number of 2.2.2. I just checked with -V
parameter:
# opensips -V
version: opensips 2.2.2 (x86_64/linux)
flags: STATS: On, DISABLE_NAGLE, USE_MCAST, SHM_MMAP, PKG_MALLOC, F_MALLOC, FAST_LOCK-ADAPTIVE_WAIT
ADAPTIVE_WAIT_LOOPS=1024, MAX_RECV_BUFFER_SIZE 262144, MAX_LISTEN 16, MAX_URI_SIZE 1024, BUF_SIZE 65535
poll method support: poll, epoll_lt, epoll_et, sigio_rt, select.
main.c compiled on with gcc 7
And I upgraded it to opensips/stretch 3.0.2-1 amd64 [upgradable from: 2.2.2-3build4]
via apt
. Now it is working! The only thing left for me is to get the panel working. I might need to adjust some configurations.
Look how stupid I am! I'm really sorry for wasting your time! And thank you very much!
<3 all good
PS: you're not the first "stupid" person who's done this, trust me... I would know best :D
Description
Tried to execute
opensips-cli
on my server (mysql 5.7 on debian 9), but the the python output shows there is no such table: "opensips.version".I've installed all required dependencies and packages before running opensips-cli. And just confirmed the user for opensips has sufficient privilege to access MySQL database.
After seeing this issue, I checked MySQL. Under
opensips
database, there is no table. And I suspect the program didn't correctly create the tables.Thanks for your help!
Details
Command line output
Environment information
Installed software
OpenSIPS-CLI configuration
The #MYSQL_ROOT# is replaced with actual root password on my server.
Thanks for reading!