ADMIN_adjust_GMTnow_on_leads.pl phone_code: 0046

Discussions about development of VICIDIAL and astGUIclient

Moderators: gerski, enjay, williamconley, Op3r, Staydog, gardo, mflorell, MJCoate, mcargile, Kumba, Michael_N

ADMIN_adjust_GMTnow_on_leads.pl phone_code: 0046

Postby DomeDan » 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:
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?
Vicidial Partner. Region: Sweden/Norway.
Does Vicidial installation, configuration, customization, add-ons, CRM implementation, support, upgrading, network-related, pentesting etc. Remote and onsite assistance.
Email: domedan (at) gmail.com
DomeDan
 
Posts: 1226
Joined: Tue Jan 04, 2011 9:17 am
Location: Sweden

Postby mflorell » Tue Mar 27, 2012 2:16 pm

Thanks for posting your patch, since many carriers need the international dialing code done differently, and since the preferred way of dealing with this is through the dialplan, we set this up this way.
mflorell
Site Admin
 
Posts: 18335
Joined: Wed Jun 07, 2006 2:45 pm
Location: Florida

Postby DomeDan » Tue Mar 27, 2012 4:44 pm

Alright I see, I thought it was the way yo do it, to put international dialing code in phone_code.
So you put s/011|0011//gi there to fix it when someone does that (when dialing out from united states), am I right?

but whats the reason for not having it this way?:
Code: Select all
-   $match_code_ORIG = $phone_codes[$d];
+   $match_code_ORIG = $phone_codes_ORIG[$d];
Vicidial Partner. Region: Sweden/Norway.
Does Vicidial installation, configuration, customization, add-ons, CRM implementation, support, upgrading, network-related, pentesting etc. Remote and onsite assistance.
Email: domedan (at) gmail.com
DomeDan
 
Posts: 1226
Joined: Tue Jan 04, 2011 9:17 am
Location: Sweden

Postby DomeDan » Tue Apr 03, 2012 4:48 am

bump.

This is a quote from "Administration: Help: List Loader"
Phone Code - the prefix for the phone number - 1 for US, 01144 for UK, 01161 for AUS, etc

I wrote an example where I used phone_code 01146
and that didn't work with ADMIN_adjust_GMTnow_on_leads.pl

I can post the patch to the issue tracker to make it work, I also found some other small bugs that I'm gonna write a patch for,
but before that I would like to know if theres any special reason this script ain't using $phone_codes_ORIG?
Vicidial Partner. Region: Sweden/Norway.
Does Vicidial installation, configuration, customization, add-ons, CRM implementation, support, upgrading, network-related, pentesting etc. Remote and onsite assistance.
Email: domedan (at) gmail.com
DomeDan
 
Posts: 1226
Joined: Tue Jan 04, 2011 9:17 am
Location: Sweden

Postby mflorell » Tue Apr 03, 2012 6:27 am

I just fixed the HELP text.

As for the other issues, I will look into those after you post the patch.

Thanks!
mflorell
Site Admin
 
Posts: 18335
Joined: Wed Jun 07, 2006 2:45 pm
Location: Florida

Postby DomeDan » Tue Apr 03, 2012 6:44 am

Great, I'm looking forward to hear your thought of $phone_codes_ORIG,
see ya on the issue tracker 8)
Vicidial Partner. Region: Sweden/Norway.
Does Vicidial installation, configuration, customization, add-ons, CRM implementation, support, upgrading, network-related, pentesting etc. Remote and onsite assistance.
Email: domedan (at) gmail.com
DomeDan
 
Posts: 1226
Joined: Tue Jan 04, 2011 9:17 am
Location: Sweden

Postby DomeDan » Wed Apr 04, 2012 12:51 am

Vicidial Partner. Region: Sweden/Norway.
Does Vicidial installation, configuration, customization, add-ons, CRM implementation, support, upgrading, network-related, pentesting etc. Remote and onsite assistance.
Email: domedan (at) gmail.com
DomeDan
 
Posts: 1226
Joined: Tue Jan 04, 2011 9:17 am
Location: Sweden


Return to Development

Who is online

Users browsing this forum: No registered users and 44 guests