Page 1 of 1

Error with recordings after Server IP change

PostPosted: Tue Mar 01, 2011 8:12 pm
by fibres
Hi all

We have recently moved our server to a new IP address.
I have run the ADMIN_update_server_ip script and updated.

Everything is working fine except for the links to click on recordings from the lead record screen.

any recordings since the change have the correct link to the recordings.

All recordings from before have the link to the old ip.

How can I fix this?

Regards

PostPosted: Tue Mar 01, 2011 8:20 pm
by mflorell
You can create a new Servers record using the old IP address(make sure you set it to inactive), then use the alternate IP in that server record to change it to the new IP address.

PostPosted: Wed Mar 02, 2011 9:54 am
by fibres
Right ok thanks.

Is there not somewhere I can change the records in the database?

Regards

PostPosted: Wed Mar 02, 2011 10:40 am
by mflorell
You can change them in the DB if you like, but it would take a rather complex SQL statement, or a program to go through the records and alter them.

PostPosted: Wed Mar 02, 2011 12:12 pm
by williamconley
it's a fairly simple update statement.

post the exact change you want to make (table, field, data from and data to with a sample record entry so i know what to strip out). for security, change one or two digits of your real ip address. but do NOT change the LENGTH of the ip address string when doing so (known length of string is what makes it easy to wring, otherwise it would be a bummer)

PostPosted: Wed Mar 02, 2011 5:51 pm
by fibres
Well I have located the recordings_log table in the database which seems to have 2 fields which apply.

Server_IP which looks easy enough to update with just a simple
update recordings_log set server_ip = "NEW IP"

However I suspect this will not update the field which seems to be where the admin page gets the location from which is called location.

this is currently
http://225.192.18.154/RECORDINGS/MP3/PH ... 35-all.mp3

and needs to be

http://225.192.22.54/RECORDINGS/MP3/PHO ... 35-all.mp3

But obviously this will need to be done for all entries of the above.

Matt. If you say simply adding a inactive server with the old IP and give it an alternate recordings location will change this.

Would changing the server_ip and then changing the locstion to external and then back on current server record give the action I desire?

Regards

PostPosted: Wed Mar 02, 2011 6:12 pm
by Kumba
What's the mysql output of this query:

SELECT location, concat('http://225.192.22.54', substr(location,1,21)) as new location FROM `recording_log` limit 1

PostPosted: Wed Mar 02, 2011 6:56 pm
by williamconley
Code: Select all
mysql> SELECT location, concat('http://225.192.22.54', substr(location,1,21)) as new_location FROM `recording_log` limit 1;
+----------------------------------------------------------------------------------+-------------------------------------------+
| location                                                                         | new_location                              |
+----------------------------------------------------------------------------------+-------------------------------------------+
| http://225.192.18.154/RECORDINGS/MP3/PHONEINS_20110221-121910_7557353535-all.mp3 | http://225.192.22.54http://225.192.18.154 |
+----------------------------------------------------------------------------------+-------------------------------------------+
2 rows in set (0.00 sec)
Close ... but a wee bit off (and that's after i changed 'new location' to 'new_location') 8)

However:
Code: Select all
mysql> SELECT location, concat('http://225.192.22.54', substr(location,22)) as new_location FROM `recording_log` limit 1;
+----------------------------------------------------------------------------------+---------------------------------------------------------------------------------+
| location                                                                         | new_location                                                                    |
+----------------------------------------------------------------------------------+---------------------------------------------------------------------------------+
| http://225.192.18.154/RECORDINGS/MP3/PHONEINS_20110221-121910_7557353535-all.mp3 | http://225.192.22.54/RECORDINGS/MP3/PHONEINS_20110221-121910_7557353535-all.mp3 |
+----------------------------------------------------------------------------------+---------------------------------------------------------------------------------+
1 row in set (0.00 sec)

So:
Code: Select all
update `recording_log` set location=concat('http://225.192.22.54', substr(location,22)) where substr(location,1,21)='http://225.192.18.154' limit 1;

PostPosted: Wed Mar 02, 2011 8:04 pm
by mflorell
Thanks for doing the SQL work on this one William!

As for the inactive servers record method, it doesn't change the SQL at all, it only changes the links as they appear in the admin pages that have the links to the recordings.

PostPosted: Wed Mar 02, 2011 8:39 pm
by williamconley
I know. You taught me that last year! 8)

But I also know that it makes the administrator "nervous" to have those records "wrong" in the database ... actually changing it gives a feeling of accomplishment. Administrator feels better because the "change to a new ip" seems more complete.

And I love sql. LOL

PostPosted: Thu Mar 03, 2011 5:21 pm
by fibres
Thank you very much.

I love SQL too, When it is doing what I want. Rest of time I want to kill whoever invented the damn thing!!

Well that worked a treat soon as I reralised that I needed to remove the limit 1 from the end and it did it to all the records.

You are right as an administrator I prefer to update things than use workarounds!!

Regards

PostPosted: Thu Mar 03, 2011 5:59 pm
by mflorell
Mike pointed out to me that this script has been in the codebase and release for over a year and a half...


/usr/share/astguiclient/ADMIN_update_archive_url.pl - updates the url in the recording_log
command-line options:
[--debug] = shows the sql as it is being executed.
[--test] = activates debuging and does not actually
execute the updates.
[--old-server-url] = the old url used to access the recordings.
This is a required argument.
[--new-server-url] = the new url used to access the recordings.
This is a required argument.

PostPosted: Thu Mar 03, 2011 8:40 pm
by williamconley
eGads it is! LOL (2.2.0 and trunk and IN the perl script folder ready to go!) lol

PostPosted: Mon Mar 07, 2011 4:19 pm
by fibres
Thats just what I was looking for Matt!!

Thanks william and others for the sql syntax to do it.

Yet again my humble thanks go out to the communtiy for all their support!!

Regards

PostPosted: Sun Dec 18, 2011 1:52 pm
by enavaro
Can someone tell me the proper usage of:

perl /usr/share/astguiclient/ADMIN_update_archive_url.pl

I already tried many combination but still it did not update my single server. First my server was in private IP then I updated it with the public IP (update_server_ip). Would like to update the recordings location on USER STATS.

I already tried this to see how the script would run.

/usr/share/astguiclient/ADMIN_update_archive_url.pl --debug

It returns with this:

/usr/share/astguiclient/ADMIN_update_archive_url.pl - updates the url in the recording_log
command-line options:
[--debug] = shows the sql as it is being executed.
[--test] = activates debuging and does not actually
execute the updates.
[--old-server-url] = the old url used to access the recordings.
This is a required argument.
[--new-server-url] = the new url used to access the recordings.
This is a required argument.

I tried this also:

/usr/share/astguiclient/ADMIN_update_archive_url.pl http://192.168.0.1/ http://220.xxx.xx.xxx/

Return with these results:

/usr/share/astguiclient/ADMIN_update_archive_url.pl - updates the url in the recording_log
command-line options:
[--debug] = shows the sql as it is being executed.
[--test] = activates debuging and does not actually
execute the updates.
[--old-server-url] = the old url used to access the recordings.
This is a required argument.
[--new-server-url] = the new url used to access the recordings.
This is a required argument.

By the way I am using the installer GoAutodial CE 2.1 Final

Would appreciate to give the correct command line options for ADMIN_update_archive_url.pl

enavaro

PostPosted: Mon Dec 19, 2011 12:28 pm
by williamconley
leave off the special characters.

Code: Select all
/usr/share/astguiclient/ADMIN_update_archive_url.pl 192.168.0.1 220.xxx.xx.xxx

Re: Error with recordings after Server IP change

PostPosted: Sat Aug 24, 2013 11:02 am
by gerski
is this still working on 2.8 version?

when i run:

[root@Asterisk1 ~]# /usr/share/astguiclient/ADMIN_update_archive_url.pl
-bash: /usr/share/astguiclient/ADMIN_update_archive_url.pl: /usr/bin/perl^M: bad interpreter: No such file or directory

Re: Error with recordings after Server IP change

PostPosted: Mon Aug 26, 2013 2:58 am
by DomeDan
That's a bug, I've posted it to the issue tracker http://www.vicidial.org/VICIDIALmantis/view.php?id=697

in the meantime you can run it through perl to make it work:

[root@Asterisk1 ~]# perl /usr/share/astguiclient/ADMIN_update_archive_url.pl

Re: Error with recordings after Server IP change

PostPosted: Mon Aug 26, 2013 3:29 pm
by Kumba
This has to do with the EOLs being in a Windows/DOS format. You can just convert the file by running 'dos2unix /usr/share/astguiclient/ADMIN_update_archive_url.pl' and hitting enter. I've seen perl mis-inerpret the line feeds as well and would suggest you convert it until I can get the two code monkeys to fix it.

Re: Error with recordings after Server IP change

PostPosted: Mon Aug 26, 2013 3:45 pm
by gerski
ok just let us know kumba.. after running dos2unix it seems like its not running other script:

Code: Select all
[root@dialer ~]# /usr/share/astguiclient/ADMIN_update_archive_url.pl XX.XX.XX.XX YY.YY.YY.YY
/usr/share/astguiclient/ADMIN_update_archive_url.pl - updates the url in the recording_log
command-line options:
  [--debug]          = shows the sql as it is being executed.
  [--test]           = activates debuging and does not actually
                       execute the updates.
  [--old-server-url] = the old url used to access the recordings.
                       This is a required argument.
  [--new-server-url] = the new url used to access the recordings.
                       This is a required argument.


even if i put perl

Code: Select all
[root@dialer ~]# perl /usr/share/astguiclient/ADMIN_update_archive_url.pl XX.XX.XX.XX YY.YY.YY.YY
/usr/share/astguiclient/ADMIN_update_archive_url.pl - updates the url in the recording_log
command-line options:
  [--debug]          = shows the sql as it is being executed.
  [--test]           = activates debuging and does not actually
                       execute the updates.
  [--old-server-url] = the old url used to access the recordings.
                       This is a required argument.
  [--new-server-url] = the new url used to access the recordings.
                       This is a required argument.

Re: Error with recordings after Server IP change

PostPosted: Mon Aug 26, 2013 4:22 pm
by Kumba
Try reading the output on the screen. You aren't telling it to do anything. You need to read the --old-server-url and --new-server-url and use those options with your IPs.

Re: Error with recordings after Server IP change

PostPosted: Mon Aug 26, 2013 6:14 pm
by gerski
already got it but it seems like it is not updating:

/usr/share/astguiclient/ADMIN_update_archive_url.pl --old-server-url=XX.XX.XX.XX --new-server-url=YY.YY.YY.YY --debugX
SELECT recording_id, location from recording_log where location LIKE 'XX.XX.XX.XX%';
Updated 0 records in the recording_log table

Re: Error with recordings after Server IP change

PostPosted: Thu Sep 19, 2013 10:36 am
by gerski
got it working just to help others it should be :

/usr/share/astguiclient/ADMIN_update_archive_url.pl --old-server-url=http://XX.XX.XX.XX --new-server-url=http://YY.YY.YY.YY --debugX