here you have the manual

http://blackhold.nusepas.com/2018/07/03/freeswitch-1-9-continuacion-mod-fs_curl-usuarios-almacenados-en-bbdd/


- Blackhold
http://blackhold.nusepas.com
@blackhold_
~> cal lluitar contra el fort per deixar de ser febles, i contra nosaltres mateixos quan siguem forts (Xirinacs)
<°((( ><

2018-07-03 1:11 GMT+02:00 Blackhold <blackholdmailer@gmail.com>:
Hi! I finally resolved!

I explain for those who could have similar problems :)

I have fixed two things in fs_curl code:

[index.php:13]
//define('START_TIME', ereg_replace('^0\.([0-9]+) ([0-9]+)$', '\2.\1', microtime()));
define('START_TIME', preg_replace('/^0\.(\d+) (\d+)$/', '\2.\1', microtime()));

ereg is deprecated for php7[6], instead use preg_replace, and you have to change the string format

[fs_directory.php:91]
//$where_array[]   = sprintf( "domain='%s'", $domain['id'] );
$where_array[]   = sprintf( "domain_id='%s'", $domain['id'] );

the easyiest way is to change here in the code. When inserting table schemas the row in table is called domain_id, not domain. Changing that you can fix this warning message

2018-07-02 19:20:53.322313 [WARNING] switch_core.c:1611 Cannot locate domain 10.XXX

Now I can enter to fs_cli and see users that are defined in database (none users config file has loaded)

freeswitch@freeswitch-capa8> list_users 
userid|context|domain|group|contact|callgroup|effective_caller_id_name|effective_caller_id_number
20000||10.XXX|default|error/user_not_registered|||
20001||10.XXX|default|error/user_not_registered|||
1010||crustaci.domain.com|default|error/user_not_registered|||
1011||crustaci.domain.com|default|error/user_not_registered|||

+OK

That's all! :)

[6] http://php.net/ereg_replace


- Blackhold
http://blackhold.nusepas.com
@blackhold_
~> cal lluitar contra el fort per deixar de ser febles, i contra nosaltres mateixos quan siguem forts (Xirinacs)
<°((( ><

2018-07-02 22:20 GMT+02:00 Blackhold <blackholdmailer@gmail.com>:
Hi,
I'm adding mod fs_curl from intralanman[1]. I have freeswitch installed from git[2]. I followed this manual[3] to install fs_curl.

It seems that pgsql connection is ok, but when configuring users to DB, list_clients doesn't shows users from database (I also tried to load FS without users file configuration). Looking at logs it appears that:

2018-07-02 19:20:49.250075 [CRIT] switch_loadable_module.c:1522 Error Loading module /usr/local/freeswitch/mod/mod_xml_curl.so
**/usr/local/freeswitch/mod/mod_xml_curl.so: cannot open shared object file: No such file or directory**

Oviously, I could not install freeswitch-mod-xml-curl package, so I simply downloaded the .deb package[4] and extracted file mod_xml_curl.so to /usr/local/freeswitch/mod/ directory.

Then it appeared an other error that I can't lead

2018-07-02 21:16:47.207969 [CRIT] switch_loadable_module.c:1522 Error Loading module /usr/local/freeswitch/mod/mod_xml_curl.so
**libssl.so.1.0.0: cannot open shared object file: No such file or directory**

I tried to create symlinks calling libssl.so.1.0.0 but it seems it have some problem to read it. The libraries that I have are libssl.so.1.1 and libssl.so.1.0.2 and are located at /usr/lib/x86_64-linux-gnu

the error continues, then I tried to install libssl that contains libssl.so.1.0.0[5] and finally get mod_xml-curl activates, then appeared and other error:

2018-07-02 21:52:23.411646 [ERR] mod_xml_curl.c:315 Received HTTP error 500 trying to fetch http://localhost/fs_curl/
data: [hostname=XXX&section=directory&tag_name=&key_name=&key_value=&Event-Name=REQUEST_PARAMS&Core-UUID=XXX&FreeSWITCH-Hostname=XXX&FreeSWITCH-Switchname=XXX&FreeSWITCH-IPv4=XXX&FreeSWITCH-IPv6=%3A%3A1&Event-Date-Local=2018-07-02%2021%3A52%3A23&Event-Date-GMT=Mon,%2002%20Jul%202018%2019%3A52%3A23%20GMT&Event-Date-Timestamp=1530561143405060&Event-Calling-File=sofia.c&Event-Calling-Function=launch_sofia_worker_thread&Event-Calling-Line-Number=3048&Event-Sequence=35&purpose=gateways&profile=external]

The apache saids me that got this error:

[Mon Jul 02 21:55:23.817938 2018] [:error] [pid 27216] [client 10.228.192.219:38874] PHP Fatal error: Uncaught Error: Call to undefined function ereg_replace() in /var/www/html/fs_curl/index.php:13\nStack trace:\n#0 {main}\n thrown in /var/www/html/fs_curl/index.php on line 13

I fixed with preg_replace() and gives this error:

[Mon Jul 02 22:05:53.353522 2018] [:error] [pid 27218] [client ::1:32960] PHP Warning:  preg_replace(): No ending delimiter '^' found in /var/www/html/fs_curl/index.php on line 13

Changing ereg for preg, it only gives a warning and freeswitch don't throw any errors*

[Mon Jul 02 22:05:53.353522 2018] [:error] [pid 27218] [client ::1:32960] PHP Warning: preg_replace(): No ending delimiter '^' found in /var/www/html/fs_curl/index.php on line 13

* yep it do, but on trying to create table schemas to db for example:
switch_pgsql.c:415 Query (create index sr_call_id on sip_registrations (call_id)) returned PGRES_FATAL_ERROR

Finally I executed fs_cli and listed users, but it appears empty. In database I have created 5 users.

freeswitch@freeswitch> list_users userid|context|domain|group|contact|callgroup|effective_caller_id_name|effective_caller_id_number +OK

# IN DB

freeswitch_db=# select * from directory_domains; id | domain_name ----+-------------------- 4 | 10.XXX 1 | crustaci.mydomain.com (2 rows)


freeswitch_db=# select * from directory; id | username | domain_id | cache ----+----------+-----------+-------- 1 | 1010 | 1 | 300000 2 | 1011 | 1 | 300000 3 | 20000 | 4 | 0 4 | 20001 | 4 | 0
5 | 20002 | 4 | 0 (4 rows)

freeswitch_db=# select * from directory_params;
 id | directory_id | param_name | param_value 
----+--------------+------------+-------------
  1 |            3 | password   | XXX
  2 |            4 | password   | XXX
  3 |            4 | password   | XXX
(2 rows)

Some ideas for why it is not working?

Thanks you much!

[5] https://packages.debian.org/wheezy/amd64/libssl1.0.0/download

- Blackhold
http://blackhold.nusepas.com
@blackhold_
~> cal lluitar contra el fort per deixar de ser febles, i contra nosaltres mateixos quan siguem forts (Xirinacs)
<°((( ><