[OpenSIPS-Users] How to set auth_db module & db_mysql module work on opensips 3.3

Bogdan-Andrei Iancu bogdan at opensips.org
Wed Sep 7 06:49:20 UTC 2022


Hi Sparkle Zou,

If you created the users with the "sip-server.com" domain, then you must 
be sure your opensips is recognizing that domain by adding it into the 
"domain" table. So add the FQDN, not the IP.

And about the error, note you have a typo there in the name of the table 
:) - it is "domain", not "domian" :)

BTW, maybe you should try to use OpenSIPS Control Panel for doing the DB 
provisioning  http://controlpanel.opensips.org/

Regards,

Bogdan-Andrei Iancu

OpenSIPS Founder and Developer
   https://www.opensips-solutions.com
OpenSIPS Summit 27-30 Sept 2022, Athens
   https://www.opensips.org/events/Summit-2022Athens/

On 9/7/22 6:31 AM, SparkleZou wrote:
>
>
> Hi Bogdan-Andrei,
> Really thanks! It works now.
>
> Here I'm trying to go further steps.
>
> Try to set the domain name.
>
> only add "opensips-cli -x user add 1000 at sip-server.com S3cureP4s$"
>
> sip-server.com already set to 192.168.3.53 at dns side.
> Change at X-lite to use 1000 at sip-server.com 
> <mailto:1000 at sip-server.com> failed to log in.
> Then try to use the USE_MULTIDOMAIN . Generate the script. And set 
> according to domain Module (opensips.org) 
> <https://opensips.org/docs/modules/3.3.x/domain.html> as following:
>
> #### DOMAIN module
> loadmodule "domain.so"
> modparam("domain", "db_url",
> "mysql://opensips:opensipsrw@localhost/opensips") # CUSTOMIZE ME
> modparam("domain", "db_mode", 0)   # Use caching
> modparam("auth_db|usrloc", "use_domain", 1)
> modparam("domain", "domain_table", "domain")
> modparam("domain", "domain_col", "domain")
> modparam("domain", "attrs_col", "attrs")
>
> But got the error "483 Too Many Hops". seems should run command 
> "insert into domian(domain) values('192.168.3.53');" to add the domain 
> info in the table domain.
>
> But got the following error.
>
> MariaDB [opensips]> insert into domian(domain) values('192.168.3.53);
> ERROR 1146 (42S02): Table 'opensips.domian' doesn't exist
>
>
> Puzzled me.
>
> Please help me. Thanks!
>
> BR,
> Sparkle Zou
>
>
>
> At 2022-09-06 16:27:10, "Bogdan-Andrei Iancu" <bogdan at opensips.org> wrote:
>
>     Hi SparkleZou,
>
>     The issue here is how the password is stored in  DB. As per the
>     sql dump, the pwd is in pre-computed HA1 format, while your
>     opensips cfg expects the pwd in plain-text format, see the
>     `calculate_ha1` and `password_column` modparams for auth_db module.
>
>     For more, see
>     https://opensips.org/html/docs/modules/3.2.x/auth_db.html#param_calculate_ha1
>
>     Regards,
>
>     Bogdan-Andrei Iancu
>
>     OpenSIPS Founder and Developer
>        https://www.opensips-solutions.com
>     OpenSIPS Summit 27-30 Sept 2022, Athens
>        https://www.opensips.org/events/Summit-2022Athens/
>
>     On 8/26/22 8:31 AM, SparkleZou wrote:
>>     Hi All,
>>
>>     I'm just start to use OpenSips. Already checked the manual. Step
>>     by Step, here I need help. Thanks! ^_^
>>
>>     1. Already install Opensips 3.3 successfully refer to OpenSIPS
>>     3.1/3.2 Installation Instructions | VoIP School
>>     <https://www.voip.school/courses/1362752/lectures/31626804>
>>
>>     2. apt install mariadb-server
>>     opensips-cli -x database create opensips
>>     root at opensips:/etc/opensips# mysql opensips -e "show tables"
>>     +--------------------+ | Tables_in_opensips |
>>     +--------------------+ | acc | | address | | clusterer | |
>>     dbaliases | | dialog | | dialplan | | dispatcher | | domain | |
>>     dr_carriers | | dr_gateways | | dr_groups | | dr_partitions | |
>>     dr_rules | | grp | | load_balancer | | location | | missed_calls
>>     | | re_grp | | rtpengine | | rtpproxy_sockets | | silo | |
>>     speed_dial | | subscriber | | tls_mgm | | uri | | usr_preferences
>>     | | version | +--------------------+
>>     MariaDB [opensips]> select * FROM subscriber;
>>     +----+----------+--------------+----------+---------------+----------------------------------+------------------------------------------------------------------+------------------------------------------------------------------+------+
>>     | id | username | domain | password | email_address | ha1 |
>>     ha1_sha256 | ha1_sha512t256 | rpid |
>>     +----+----------+--------------+----------+---------------+----------------------------------+------------------------------------------------------------------+------------------------------------------------------------------+------+
>>     | 1 | 1000 | 192.168.3.53 | | | 1c77bd7afa5414714be613363977341f
>>     |
>>     a821eb87519b53a8e505184a8798b9300dd1788c32ce59026c6f047d5f0eb717
>>     |
>>     1947492ee9de11818d8a54cc5969bd87e5622f412e1b3e1a117ce8c44b936b5d
>>     | NULL | | 2 | 1001 | 192.168.3.53 | | |
>>     c3d0ccc517e752190644392e7f0c5d93 |
>>     b4efb98003f1e5f75ad6ca5ce320a367a430415b9e304ef384e19b969e14ea44
>>     |
>>     49a9a44fbb296fed9c7fe9b4e86ef113642d2e911fe34e93742cc249de261d5a
>>     | NULL |
>>     +----+----------+--------------+----------+---------------+----------------------------------+------------------------------------------------------------------+------------------------------------------------------------------+------+
>>     2 rows in set (0.000 sec)
>>     accounts 1000 & 1001 are already created in db.
>>     run /usr/sbin/osipsconfig select ENABLE_TCP & USE_AUTH, generate
>>     the CFG file.
>>     ____________________________________________ | | | [*] ENABLE_TCP
>>     | | [ ] ENABLE_TLS | | [ ] USE_ALIASES | | [*] USE_AUTH | | [ ]
>>     USE_DBACC | | [ ] USE_DBUSRLOC | | [ ] USE_DIALOG | | [ ]
>>     USE_MULTIDOMAIN | | [ ] USE_NAT | | [ ] USE_PRESENCE | | [ ]
>>     USE_DIALPLAN | | [ ] VM_DIVERSION | | [ ] HAVE_INBOUND_PSTN | | [
>>     ] HAVE_OUTBOUND_PSTN | | [ ] USE_DR_PSTN | | [ ]
>>     USE_HTTP_MANAGEMENT_INTERFACE |
>>     |____________________________________________|
>>     Then start the opensips. But REGISTER get 401 fail message.
>>
>>     REGISTER sip:192.168.3.53 SIP/2.0
>>
>>     Via: SIP/2.0/UDP
>>     10.120.100.250:39720;branch=z9hG4bK-d87543-ec515058dd0d9227-1--d87543-;rport
>>
>>     Max-Forwards: 70
>>
>>     Contact: <sip:1000 at 10.120.100.250:39720;rinstance=69251742e61e3bf0>
>>
>>     To: "1000"<sip:1000 at 192.168.3.53>
>>
>>     From: "1000"<sip:1000 at 192.168.3.53>;tag=a16e1263
>>
>>     Call-ID: ZTY2NDZlYjc1ZTE3MGE4ZjI5YzhhZjA4M2IzYTIyZTc.
>>
>>     CSeq: 1 REGISTER
>>
>>     Expires: 3600
>>
>>     Allow: INVITE, ACK, CANCEL, OPTIONS, BYE, REFER, NOTIFY, MESSAGE,
>>     SUBSCRIBE, INFO
>>
>>     User-Agent: X-Lite release 1011s stamp 41150
>>
>>     Content-Length: 0
>>
>>
>>     SIP/2.0 401 Unauthorized
>>
>>     Via: SIP/2.0/UDP
>>     10.120.100.250:39720;received=192.168.3.250;branch=z9hG4bK-d87543-ec515058dd0d9227-1--d87543-;rport=39720
>>
>>     To:
>>     "1000"<sip:1000 at 192.168.3.53>;tag=a42c.30207dd1fda47907656684ceecd519a5
>>
>>     From: "1000"<sip:1000 at 192.168.3.53>;tag=a16e1263
>>
>>     Call-ID: ZTY2NDZlYjc1ZTE3MGE4ZjI5YzhhZjA4M2IzYTIyZTc.
>>
>>     CSeq: 1 REGISTER
>>
>>     WWW-Authenticate: Digest realm="192.168.3.53",
>>     nonce="Tx723UFoxz9VG6/4szaVxWNyEKleCmoNQbbunbDRcdAA", qop="auth"
>>
>>     Server: OpenSIPS (3.3.1 (x86_64/linux))
>>
>>     Content-Length: 0
>>
>>
>>     The opensips.cfg is attached. Please help check where is the
>>     problem. Thanks!
>>
>>
>>     BR,
>>
>>     SparkleZou
>>
>>
>>     _______________________________________________
>>     Users mailing list
>>     Users at lists.opensips.org
>>     http://lists.opensips.org/cgi-bin/mailman/listinfo/users
>

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.opensips.org/pipermail/users/attachments/20220907/2820978f/attachment-0001.html>


More information about the Users mailing list