Page 1 of 1

Help with Recording Gateway Server

PostPosted: Tue Jan 28, 2025 11:24 pm
by alex.mejia
I'm running ViciBox 12.0.2 Express installation on lab virtual machines.
VERSION: 2.14-934a
BUILD: 250103-0843

Server A (Database/Asterisk/Agents server)
Server B (astguiclient.conf DB server pointing to Server A)

Server B has PJSIP trunks to get calls from carrier and to send calls to Server A.
Dialplan on Server A modified to run agi-VICIrecGateway.agi as per manual and SIP header insertion working correctly.
Disabled audio related cron jobs on both servers.

Call comes from carrier to Server B, agi-VICIrecGateway.agi gets executed and both gateway_recording_log and recording_log inserted with this call's information.
gateway_recording_id = 1
recording_id = 1

Call comes to Server A to an ingroup for who's campaign has ALLFORCE recording option, so another record is inserted on recording_id
recording_id = 2

Then I manually run
Code: Select all
# /usr/share/astguiclient/AST_CRON_audio_1_gateway_stereo.pl --STEREO --debugX

It correctly merges the CARRIER and DIALER audio files and updates recording_log's location for id=1

Finally I manually run
Code: Select all
# /usr/share/astguiclient/AST_CRON_audio_2_compress.pl --MP3 --GATEWAY --debugX

It correctly compress wav to mp3 and updates recording_log's location for id=1

The problem:
Because the campaign recording id is 2, the recording link on the agent's stats "Recordings for this time period" will not be updated with the stereo recording.
I tried disabling ALLFORCE for the campaign hoping the procedure checks if there's a recording for the call triggered on the recording gateway without luck.

I may be doing something wrong, since I didn't find much documentation on this feature or I'm missing something somewhere.

Please advise... :?

Re: Help with Recording Gateway Server

PostPosted: Wed Jan 29, 2025 1:50 am
by carpenox

Re: Help with Recording Gateway Server

PostPosted: Wed Jan 29, 2025 11:31 am
by alex.mejia
Thanks carpenox. I read the whole document to be able to configure everything.
It's just that I don't find info regarding my question there.
Can you point it out?

Re: Help with Recording Gateway Server

PostPosted: Wed Jan 29, 2025 11:52 am
by williamconley
When you run those two scripts, on which server do you run them? Note that a machine that has only the ID=2 can only manage that file, same with ID=1.

Re: Help with Recording Gateway Server

PostPosted: Wed Jan 29, 2025 12:04 pm
by alex.mejia
Thanks William

I'm running the CRON scripts on Server B (Recording Gateway Server) but I configured it's astguiclient.conf to use Server A database:
VARDB_server => 192.168.200.20 #Server A IP Address

Then I suppose all database operations are being processed on Server A.
As the stereo recording files reside on Server B, I'm running the scripts there.

Re: Help with Recording Gateway Server

PostPosted: Wed Jan 29, 2025 2:46 pm
by alex.mejia
Maybe just to summarize my original question:

Stereo recordings are working just fine, but I think it's not working properly because it's not rewriting the recording path for the agent's recording log.
Or there's no correlation between what's recorded on the gateway and on the dialer.

For example, for the same call, there are 2 recording_log entries:
Image

So there's no way to access those recordings from the GUI.
Please correct me if I'm wrong or I'm expecting something it's not meant to be hehe.

Thanks!

Re: Help with Recording Gateway Server

PostPosted: Wed Jan 29, 2025 3:13 pm
by williamconley
alex.mejia wrote:Thanks William

I'm running the CRON scripts on Server B (Recording Gateway Server) but I configured it's astguiclient.conf to use Server A database:
VARDB_server => 192.168.200.20 #Server A IP Address

Then I suppose all database operations are being processed on Server A.
As the stereo recording files reside on Server B, I'm running the scripts there.


Post the results of a single conversion/compression/move/ftp everything for that one file. In theory when the file is moved to archive via ftp, if the original record is identified properly for the agent and the lead that should alter the link for both of those to the newly moved file.

Re: Help with Recording Gateway Server

PostPosted: Wed Jan 29, 2025 8:08 pm
by alex.mejia
DIALER (192.168.200.20):
Code: Select all
# /usr/share/astguiclient/AST_CRON_audio_1_move_VDonly.pl --debugX

----- DEBUG -----


----- SUPER DEBUG -----

20250129-190111_34001900-in.wav 103404
20250129-190111_34001900-out.wav 44
20250129-190111_34001900-in.wav 103404


|SELECT recording_id,length_in_sec,lead_id,vicidial_id,start_time,end_time,user from recording_log where filename='20250129-190111_34001900' order by recording_id desc LIMIT 1;|
|46|6|20250129-190111_34001900-in.wav|     |20250129-190111_34001900-all.wav|

|UPDATE recording_log set location='http://192.168.200.20/RECORDINGS/20250129-190111_34001900-all.wav'   where recording_id='46';|
20250129-190111_34001900-out.wav

DONE... EXITING

Code: Select all
# /usr/share/astguiclient/AST_CRON_audio_2_compress.pl --MP3 --debugX

----- DEBUG -----


----- SUPER DEBUG -----

MP3 compression
SOX:     LAME: /usr/bin/lame
20250129-190111_34001900-all.wav
20250129-190111_34001900-all.wav


|select recording_id, LEFT(start_time,10) AS file_date from recording_log where filename='20250129-190111_34001900' order by recording_id desc LIMIT 1;|
|46|20250129-190111_34001900-all.wav|/var/spool/asterisk/monitorDONE/MP3/20250129-190111_34001900-all.mp3|     ||

|UPDATE recording_log set location='http://192.168.200.20/RECORDINGS/MP3/20250129-190111_34001900-all.mp3' where recording_id='46';|
DONE... EXITING

Code: Select all
# /usr/share/astguiclient/AST_CRON_audio_3_ftp.pl --MP3 --run-check --debugX

----- DEBUG -----


----- SUPER DEBUG -----


----- CONCURRENCY CHECK -----

MP3 audio files
/var/spool/asterisk/monitorDONE/MP3/20250129-190111_34001900-all.mp3 13248
/var/spool/asterisk/monitorDONE/MP3/20250129-190111_34001900-all.mp3 13248


|select recording_id,start_time from recording_log where filename='20250129-190111_34001900' order by recording_id desc LIMIT 1;|
|46|2025-01-29|20250129-190111_34001900-all.mp3|     ||
Connecting to FTP server in passive mode...
Net::FTP>>> Net::FTP(3.10)
Net::FTP>>>   Exporter(5.72)
Net::FTP>>>   Net::Cmd(3.10)
Net::FTP>>>   IO::Socket::SSL(2.089)
Net::FTP>>>     IO::Socket::IP(0.38)
Net::FTP>>>       IO::Socket(1.38)
Net::FTP>>>         IO::Handle(1.36)
Net::FTP=GLOB(0x55f306b08478)<<< 220 192.168.200.211 FTP server ready
Net::FTP=GLOB(0x55f306b0ed28)<<< 220 192.168.200.211 FTP server ready
Net::FTP=GLOB(0x55f306b0ed28)>>> USER vicidial
Net::FTP=GLOB(0x55f306b0ed28)<<< 331 Password required for vicidial
Net::FTP=GLOB(0x55f306b0ed28)>>> PASS ....
Net::FTP=GLOB(0x55f306b0ed28)<<< 230 User vicidial logged in
Net::FTP=GLOB(0x55f306b0ed28)>>> CWD /array1/vicidial/htdocs
Net::FTP=GLOB(0x55f306b0ed28)<<< 250 CWD command successful
Net::FTP=GLOB(0x55f306b0ed28)>>> MKD 2025-01-29
Net::FTP=GLOB(0x55f306b0ed28)<<< 550 2025-01-29: File exists
Net::FTP=GLOB(0x55f306b0ed28)>>> CWD 2025-01-29
Net::FTP=GLOB(0x55f306b0ed28)<<< 250 CWD command successful
Net::FTP=GLOB(0x55f306b0ed28)>>> TYPE I
Net::FTP=GLOB(0x55f306b0ed28)<<< 200 Type set to I
Net::FTP=GLOB(0x55f306b0ed28)>>> PASV
Net::FTP=GLOB(0x55f306b0ed28)<<< 227 Entering Passive Mode (192,168,200,211,205,164).
Net::FTP=GLOB(0x55f306b0ed28)>>> STOR 20250129-190111_34001900-all.mp3
Net::FTP=GLOB(0x55f306b0ed28)<<< 150 Opening BINARY mode data connection for 20250129-190111_34001900-all.mp3
Net::FTP=GLOB(0x55f306b0ed28)<<< 226 Transfer complete
Net::FTP=GLOB(0x55f306b0ed28)>>> QUIT
Net::FTP=GLOB(0x55f306b0ed28)<<< 221 Goodbye.

|UPDATE recording_log set location='http://192.168.200.211:81/2025-01-29/20250129-190111_34001900-all.mp3' where recording_id='46';|
Transfered 1 files
DONE... EXITING


GATEWAY (192.168.200.19):
Code: Select all
# /usr/share/astguiclient/AST_CRON_audio_1_gateway_stereo.pl --STEREO --debugX

----- DEBUG -----


----- SUPER DEBUG -----

STEREO directory audio processing only
Can't find soxmix binary! Trying sox...
DIALER_G1291901010000000015_20250129190101.wav 229484
CARRIER_G1291901010000000015_20250129190101.wav 229484
Total recording files found: 4 (calls: 1)
DIALER_G1291901010000000015_20250129190101.wav 229484


|select recording_id,length_in_sec from recording_log where filename='G1291901010000000015_20250129190101' order by recording_id desc LIMIT 1;|
|45|0|DIALER_G1291901010000000015_20250129190101.wav|CARRIER_G1291901010000000015_20250129190101.wav|     |G1291901010000000015_20250129190101.wav|

|UPDATE recording_log set location='http://192.168.200.19/RECORDINGS/G1291901010000000015_20250129190101.wav' ,length_in_sec='14',length_in_min='0.23' where recording_id='45';|
CARRIER_G1291901010000000015_20250129190101.wav

DONE... EXITING

Code: Select all
# /usr/share/astguiclient/AST_CRON_audio_2_compress.pl --MP3 --GATEWAY --debugX

----- DEBUG -----


----- SUPER DEBUG -----

GATEWAY settings option enabled
MP3 compression
SOX:     LAME: /usr/bin/lame
G1291901010000000015_20250129190101.wav
G1291901010000000015_20250129190101.wav


|select recording_id, LEFT(start_time,10) AS file_date from recording_log where filename='G1291901010000000015_20250129190101' order by recording_id desc LIMIT 1;|
|45|G1291901010000000015_20250129190101.wav|/var/spool/asterisk/monitorDONE/MP3/G1291901010000000015_20250129190101.mp3|     ||

|UPDATE recording_log set location='http://192.168.200.19/RECORDINGS/MP3/G1291901010000000015_20250129190101.mp3' where recording_id='45';|
DONE... EXITING

Code: Select all
# /usr/share/astguiclient/AST_CRON_audio_3_ftp.pl --MP3 --run-check --GATEWAY --debugX

----- DEBUG -----


----- SUPER DEBUG -----


----- CONCURRENCY CHECK -----

MP3 audio files
/var/spool/asterisk/monitorDONE/MP3/G1291901010000000015_20250129190101.mp3 29088
/var/spool/asterisk/monitorDONE/MP3/G1291901010000000015_20250129190101.mp3 29088


|select recording_id,start_time from recording_log where filename='G1291901010000000015_20250129190101' order by recording_id desc LIMIT 1;|
|45|2025-01-29|G1291901010000000015_20250129190101.mp3|     ||
Connecting to FTP server in passive mode...
Net::FTP>>> Net::FTP(3.10)
Net::FTP>>>   Exporter(5.72)
Net::FTP>>>   Net::Cmd(3.10)
Net::FTP>>>   IO::Socket::SSL(2.089)
Net::FTP>>>     IO::Socket::IP(0.38)
Net::FTP>>>       IO::Socket(1.38)
Net::FTP>>>         IO::Handle(1.36)
Net::FTP=GLOB(0x55f539d1ac08)<<< 220 192.168.200.211 FTP server ready
Net::FTP=GLOB(0x55f539d21568)<<< 220 192.168.200.211 FTP server ready
Net::FTP=GLOB(0x55f539d21568)>>> USER vicidial
Net::FTP=GLOB(0x55f539d21568)<<< 331 Password required for vicidial
Net::FTP=GLOB(0x55f539d21568)>>> PASS ....
Net::FTP=GLOB(0x55f539d21568)<<< 230 User vicidial logged in
Net::FTP=GLOB(0x55f539d21568)>>> CWD /array1/vicidial/htdocs
Net::FTP=GLOB(0x55f539d21568)<<< 250 CWD command successful
Net::FTP=GLOB(0x55f539d21568)>>> MKD 2025-01-29
Net::FTP=GLOB(0x55f539d21568)<<< 550 2025-01-29: File exists
Net::FTP=GLOB(0x55f539d21568)>>> CWD 2025-01-29
Net::FTP=GLOB(0x55f539d21568)<<< 250 CWD command successful
Net::FTP=GLOB(0x55f539d21568)>>> TYPE I
Net::FTP=GLOB(0x55f539d21568)<<< 200 Type set to I
Net::FTP=GLOB(0x55f539d21568)>>> PASV
Net::FTP=GLOB(0x55f539d21568)<<< 227 Entering Passive Mode (192,168,200,211,133,121).
Net::FTP=GLOB(0x55f539d21568)>>> STOR G1291901010000000015_20250129190101.mp3
Net::FTP=GLOB(0x55f539d21568)<<< 150 Opening BINARY mode data connection for G1291901010000000015_20250129190101.mp3
Net::FTP=GLOB(0x55f539d21568)<<< 226 Transfer complete
Net::FTP=GLOB(0x55f539d21568)>>> QUIT
Net::FTP=GLOB(0x55f539d21568)<<< 221 Goodbye.

|UPDATE recording_log set location='http://192.168.200.211:81/2025-01-29/G1291901010000000015_20250129190101.mp3' where recording_id='45';|
Transfered 1 files
DONE... EXITING

Re: Help with Recording Gateway Server

PostPosted: Wed Jan 29, 2025 10:09 pm
by williamconley
So we're looking for recording ID 45 and 46. Where do those appear on the Modify Agent page and Modify Lead page? Are you saying id 45 is not linked to the agent or the lead?

The gateway perl script searches for the record with a filename that matches a pattern, and it seems to expect more than one record in response. It takes the first record in descending order (ie: the record with the highest ID) so it would pick up the record created last, which in this case would be 46. But: One is "G1291901010000000015_20250129190101" and one is "20250129-190111_34001900". Since those don't match, it returns ONLY the recording on the gateway server. NO mtach only because the filename/pattern does not match from the gateway recording to the dialer recording.

Now, I've not looked into this coding for this script, but I'd be expecting there to be a way to make those filenames match by setting the file naming variable the same in both systems, then this query:

Code: Select all
|select recording_id, LEFT(start_time,10) AS file_date from recording_log where filename='G1291901010000000015_20250129190101' order by recording_id desc LIMIT 1;|


Would have resulted in record 46 rather than 45.

Code: Select all
|45|G1291901010000000015_20250129190101.wav|/var/spool/asterisk/monitorDONE/MP3/G1291901010000000015_20250129190101.mp3|     ||


I would also expect there to be instructions in the setup for these variable to match.

As I said, though: I have not verified any of this against the code, the setup instructions, or any systems. Just looking at what you've posted and my understanding of how Vicidial tends to make things "work" 8-)

Re: Help with Recording Gateway Server

PostPosted: Thu Jan 30, 2025 1:35 pm
by alex.mejia
Thanks for taking the time William

By extracting the "evidence" you needed helped me digging a bit more into the issue and even tried to understand the code of the related scripts.
So far I found there's nothing on the scripts that tries to correlate the stereo recording on the gateway with a lead_id on the dialer, so I'll be working on something that does this "match".
At the end of all processing, the table "gateway_recording_log" keeps lead_id = 0

I'll be playing a bit more with it and in case I find something usefull for future reference I'll post it here.

Thanks!

Re: Help with Recording Gateway Server

PostPosted: Thu Jan 30, 2025 2:39 pm
by mflorell
As long as the callerIDname is not being altered, the VICIdial CallerIDname will have the Lead ID in it, and the agi-VICIrecGateway.agi script will log that to the gateway_recording_log database table for outbound calls. For inbound calls, the Gateway server should be setting the "VICIrecGatewayID" SIP channel variable, that the agi-DID_route.agi script on the VICIdial server then uses to link up the call to the gateway recording ID, and eventually the Lead ID on the VICIdial server.