Support A2Billing :

provided by Star2Billing S.L.

Support A2Billing :
It is currently Fri Mar 29, 2024 8:38 am
VoIP Billing solution


All times are UTC




Post new topic Reply to topic  [ 6 posts ] 
Author Message
 Post subject: Undefined variable
PostPosted: Fri Jan 11, 2008 8:02 pm 
Offline

Joined: Mon May 21, 2007 3:52 pm
Posts: 6
Hello

I am running a2billing 1.3.1 with asterisk 1.2.18 and druid web interface and i keep getting undefined variable messages in /var/log/asterisk/messages.

/var/lib/asterisk/agi-bin/libs_a2billing/Class.RateEngine.php[661]: Undefined variable: agi/var/lib/asterisk/agi-bin/libs_a2billing/Class.RateEngine.php[700]: Undefined variable: agi
/var/lib/asterisk/agi-bin/libs_a2billing/Class.RateEngine.php[777]: Undefined variable: agi
/var/lib/asterisk/agi-bin/libs_a2billing/Class.RateEngine.php[416]: Undefined variable: callbackrate

I have gotten the undefined variable: agi in previous versions of a2billing (could it be my system is causing this?) but the undefined variable: callbackrate I have only seen it after installing 1.3.1.
I have tried some of the suggestions in this forum, for example for the agi message, i have tried both DeadAGI and AGI in extensions.conf. I also get incorrect call times and charges occasionally (are the issues linked?).

Any assistance would be aapreciated.


Top
 Profile  
 
 Post subject:
PostPosted: Fri Jan 11, 2008 9:30 pm 
Offline
User avatar

Joined: Mon Apr 30, 2007 6:43 am
Posts: 1060
Location: Canada
Hello wongital.

The variable callbackrate is a result of a patch that I have submitted long ago. And I have just noticed a typo in Class.RateEngine.php

Code:
399            $callback_rate = array();
400           
401            if(($A2B->mode == 'cid-callback') || ($A2B->mode == 'all-callback')){
402                $callbackrate['rateinitial']=$rateinitial;
403                $callbackrate['initblock']=$initblock;
404                $callbackrate['billingblock']=$billingblock;
405                $callbackrate['connectcharge']=$connectcharge;
406                $callbackrate['disconnectcharge']=$disconnectcharge;
407                $callbackrate['stepchargea']=$stepchargea;
408                $callbackrate['timechargea']=$timechargea;
409                $callbackrate['stepchargeb']=$stepchargeb;
410                $callbackrate['timechargeb']=$timechargeb;
411                $callbackrate['stepchargec']=$stepchargec;
412                $callbackrate['timechargec']=$timechargec;
413            }
414    
415            $this -> ratecard_obj[$K]['callbackrate']=$callbackrate;


The line 399 should read

Code:
399            $callbackrate = array();


You are receiving these error or rather warnings because the php.ini of the PHP CLI is configured to report them. You can suppress them and only activated them during debugging.

We can also find all those warnings and correct the issue.


Top
 Profile  
 
 Post subject:
PostPosted: Fri Jan 11, 2008 9:56 pm 
Offline
Moderator
User avatar

Joined: Thu Jun 22, 2006 2:19 pm
Posts: 2890
Location: Devon, UK
asiby wrote:
The line 399 should read
Committed at r503. :wink:
Quote:
We can also find all those warnings and correct the issue.
I'm not sure it's that simple, my friend. All the errors quote line numbers where A2B is printing debug info, e.g.
Code:
$A2B -> debug( WRITELOG, $agi, __FILE__, __LINE__, "[....]");
The '$agi' variable it's complaining about is supposed to be our instance of PHPAGI. It seems PHPAGI is not correctly initialising for some reason.
wongital wrote:
I also get incorrect call times and charges occasionally (are the issues linked?).
Well, if my guess is correct then I would have expected the call to be passed back to Asterisk without A2B having done anything.


Top
 Profile  
 
 Post subject:
PostPosted: Sat Jan 12, 2008 5:12 am 
Offline
User avatar

Joined: Mon Apr 30, 2007 6:43 am
Posts: 1060
Location: Canada
I thing that there's still a way my friend. But I had noticed that before in the function rate_engine_calcultimeout a while ago. That why I have added the "global $agi" to make the $agi variable available inside the function. The same thing must be done for function rate_engine_calculcost.

In other words, the following should become

Code:
639        function rate_engine_calculcost (&$A2B, $callduration, $K=0)
640        {
641            $K = $this->usedratecard;


should become

Code:
639        function rate_engine_calculcost (&$A2B, $callduration, $K=0)
640        {
...            global $agi;
641            $K = $this->usedratecard;


That should do it.

Regards


Top
 Profile  
 
 Post subject:
PostPosted: Mon Jan 14, 2008 3:09 am 
Offline

Joined: Mon May 21, 2007 3:52 pm
Posts: 6
Thanx alot guys the messages seem to be gone.


Top
 Profile  
 
 Post subject:
PostPosted: Mon Jan 14, 2008 5:37 pm 
Offline
User avatar

Joined: Mon Apr 30, 2007 6:43 am
Posts: 1060
Location: Canada
You can display more of these notice and warning message by greping your message files.

Try this

Code:
grep -ir undefined /var/log/messages*


or

Code:
grep -ir warning /var/log/messages*


or try various keywords that can suggest a problem.

In my case, there was a disturbingly huge amount of warning messages regarding the timezone settings. If you have them as well, you can fix them by setting the "date.timezone" option in php.ini (for both CLI and Apache).

The other "undefined variable" notices must be fixed. It may someday lead to instabilities in A2Billing.


Top
 Profile  
 
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 6 posts ] 
Voice Broadcast System


All times are UTC


Who is online

Users browsing this forum: No registered users and 12 guests


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to:  
cron
Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group