ADMIN_adjust_GMTnow_on_leads.pl phone_code: 0046
Posted: Tue Mar 27, 2012 10:50 am
I've been struggling with Daylight saving time (DST) every time it has occur for me using vicidial.
The reason is that ADMIN_adjust_GMTnow_on_leads.pl aint working in my case.
That is because I'm using 0046 as phone_code in vicidial_list and then the script can't match that with country_code in vicidial_phone_codes.
So I tried changing the vicidial_phone_codes table:
country_code from smallint(5) to varchar(10) and added 0046 as a country_code.
Thats working but its not a nice way to do it.
I could probably change phone_code on every lead to 46
and use something like this I guess: (before/after)
exten => _90046ZXXXXX.,1,Dial(${TRUNK}/${EXTEN:1},,tTor)
exten => _946ZXXXXX.,1,Dial(${TRUNK}/00${EXTEN:1},,tTor)
But I would like to edit ADMIN_adjust_GMTnow_on_leads.pl so it will work with both 46 and 0046
because in my opinion all this script needs to care about is where the lead is located and the timezone-settings for that location.
I can't get a grip of the script...
In version 110513-1444 I see this at row 370 to 372:
I cant understand how that will work if phone_code is like 011 or 0011,
it would make sense if an update-query would do: "where phone_code = '$phone_codes_ORIG[$rec_countY]'" but it doesnt, $phone_codes_ORIG aint used anywhere else in the script, instead I see this:
and it comes from:
So if I understand this right the update query would not update the leads if their phone_code is like 01146 or 001146, after some testing it seams I'm right, proof:
If i do this change to the script:
It will update gmt_offset_now like it should!
it seams like its suppose to work like this....
And if I also change this:
it will remove 00 from 0046 and update gmt_offset_now correctly on the leads that got phone_code 0046
So is this a bug, and should suppose to work like I just explained?
The reason is that ADMIN_adjust_GMTnow_on_leads.pl aint working in my case.
That is because I'm using 0046 as phone_code in vicidial_list and then the script can't match that with country_code in vicidial_phone_codes.
So I tried changing the vicidial_phone_codes table:
country_code from smallint(5) to varchar(10) and added 0046 as a country_code.
Thats working but its not a nice way to do it.
I could probably change phone_code on every lead to 46
and use something like this I guess: (before/after)
exten => _90046ZXXXXX.,1,Dial(${TRUNK}/${EXTEN:1},,tTor)
exten => _946ZXXXXX.,1,Dial(${TRUNK}/00${EXTEN:1},,tTor)
But I would like to edit ADMIN_adjust_GMTnow_on_leads.pl so it will work with both 46 and 0046
because in my opinion all this script needs to care about is where the lead is located and the timezone-settings for that location.
I can't get a grip of the script...
In version 110513-1444 I see this at row 370 to 372:
- Code: Select all
$phone_codes[$rec_countY] = $aryA[0];
$phone_codes_ORIG[$rec_countY] = $aryA[0];
$phone_codes[$rec_countY] =~ s/011|0011| |\t|\r|\n//gi;
I cant understand how that will work if phone_code is like 011 or 0011,
it would make sense if an update-query would do: "where phone_code = '$phone_codes_ORIG[$rec_countY]'" but it doesnt, $phone_codes_ORIG aint used anywhere else in the script, instead I see this:
- Code: Select all
"where phone_code='$match_code_ORIG'"
and it comes from:
- Code: Select all
$match_code_ORIG = $phone_codes[$d];
So if I understand this right the update query would not update the leads if their phone_code is like 01146 or 001146, after some testing it seams I'm right, proof:
mysql> SELECT lead_id, gmt_offset_now, phone_code, phone_number FROM `asterisk`.`vicidial_list` where `lead_id` = 1;
- Code: Select all
+---------+----------------+------------+--------------+
| lead_id | gmt_offset_now | phone_code | phone_number |
+---------+----------------+------------+--------------+
| 1 | 1.00 | 01146 | 7275551212 |
+---------+----------------+------------+--------------+
./ADMIN_adjust_GMTnow_on_leads.pl --debugX --singlelistid=101
- Code: Select all
|select distinct phone_code from vicidial_list where list_id='101' ;|
|01146|
|1|
- Unique Country dial codes found: 2
|select country_code,country,areacode,state,GMT_offset,DST,DST_range,geographic_description,tz_code from vicidial_phone_codes;|
RUNNING LOOP FOR COUNTRY CODE: 46
PROCESSING THIS LINE: 46 SWE * +1 Y LSM-LSO Sweden CET
|select count(*) from vicidial_list where phone_code='46' and list_id='101' ;|
Area Code Updates: 0
Postal Updates: 0
NANPA Updates: 0
Time Zone Code Updates: 0
mysql> SELECT lead_id, gmt_offset_now, phone_code, phone_number FROM `asterisk`.`vicidial_list` where `lead_id` = 1;
- Code: Select all
+---------+----------------+------------+--------------+
| lead_id | gmt_offset_now | phone_code | phone_number |
+---------+----------------+------------+--------------+
| 1 | 1.00 | 01146 | 7275551212 |
+---------+----------------+------------+--------------+
If i do this change to the script:
- Code: Select all
- $match_code_ORIG = $phone_codes[$d];
+ $match_code_ORIG = $phone_codes_ORIG[$d];
It will update gmt_offset_now like it should!
it seams like its suppose to work like this....
And if I also change this:
- Code: Select all
- $phone_codes[$rec_countY] =~ s/011|0011| |\t|\r|\n//gi;
+ $phone_codes[$rec_countY] =~ s/011|0011| |\t|\r|\n|^00//gi;
it will remove 00 from 0046 and update gmt_offset_now correctly on the leads that got phone_code 0046
So is this a bug, and should suppose to work like I just explained?