bug reading astguiclient.conf properly

Discussions about development of VICIDIAL and astGUIclient

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

bug reading astguiclient.conf properly

Postby kchung » Thu Oct 05, 2006 9:22 pm

While working on a patch, I found a bug in how AST_CRON_mix_recordings_*.pl and other scripts read astguiclient.conf.

I had added this to astguiclient.conf after the PATHmonitor entry:
Code: Select all
PATHmonitor_done => /var/spool/asterisk/monitor/DONE


in AST_CRON_mix_recordings_*.pl files, i added this after line 68:
Code: Select all
if ( ($line =~ /^PATHmonitor_done/) && ($CLImonitor_done < 1) )
           {$PATHmonitor_done = $line;   $PATHmonitor_done =~ s/.*=//gi;}


The result was that $PATHmonitor got overwritten by $PATHmonitor the next time the loop was run.

Is there a better way to read the .conf file so we can use similar variable names?

My solution was to change the variable name to PATHmon_done, not as intuitive as I'd like.
kchung
 
Posts: 208
Joined: Fri Aug 04, 2006 5:28 pm

Postby mflorell » Fri Oct 06, 2006 9:16 am

I'm not quite sure I understand your problem. Were you adding a DONE variable to the astguiclient.conf file?

If so you would need to just name it something different without the same prefix like "PATHDONEmonitor" and you would've had no issues.
mflorell
Site Admin
 
Posts: 18386
Joined: Wed Jun 07, 2006 2:45 pm
Location: Florida

Postby kchung » Fri Oct 06, 2006 11:51 am

In addition to the PATHmonitor variable, I added PATHmonitor_done.

What I don't understand is why the VARDB_* series of variables passed w/o problems but PATHmonitor_done didn't. Even PATHmonitordone did't.

I did change the variable to PATHmon_done, but I thought PATHmonitor_done was more intuitive.
kchung
 
Posts: 208
Joined: Fri Aug 04, 2006 5:28 pm

Postby mflorell » Fri Oct 06, 2006 2:01 pm

It is filtered by the variable name, since you began the _done one with the exact same name as the monitor path one it overwrote it when it did it's loop pass.

You cannot have the root of another variable in any new variable names that are created.
mflorell
Site Admin
 
Posts: 18386
Joined: Wed Jun 07, 2006 2:45 pm
Location: Florida

Postby kchung » Fri Oct 06, 2006 4:08 pm

Ah thanks. So, if we rename PATHmonitor to PATHmonitor_raw, then PATHmonitor_done would be fine.
kchung
 
Posts: 208
Joined: Fri Aug 04, 2006 5:28 pm

Postby mflorell » Fri Oct 06, 2006 4:16 pm

yep, that'll do it for you
mflorell
Site Admin
 
Posts: 18386
Joined: Wed Jun 07, 2006 2:45 pm
Location: Florida

Postby kchung » Fri Oct 06, 2006 4:56 pm

I couldnt find any good documentation on the =~ operator for perl.
kchung
 
Posts: 208
Joined: Fri Aug 04, 2006 5:28 pm

Postby mflorell » Fri Oct 06, 2006 5:43 pm

That's the regular expression operator or perl. it's a way of using symbols and matchin text to see if something matches, you can also do search-and-replace with it.

http://www.troubleshooters.com/codecorn ... erlreg.htm
http://www.anaesthetist.com/mnm/perl/regex.htm
mflorell
Site Admin
 
Posts: 18386
Joined: Wed Jun 07, 2006 2:45 pm
Location: Florida


Return to Development

Who is online

Users browsing this forum: No registered users and 12 guests