[asterisk-users] AGI CDR Update (with set variable) problem.

Oğuzhan Kayhan oguzhank at bilkent.edu.tr
Sat Nov 20 12:17:48 CST 2010


hello,

First of all i am using Asterisk 1.6.2.9-2

The following problem seem like a bug to me but im not sure.

Any help or comment will be great..

 

We are trying to implement our own billing software with AGI - Php Scripts.

 

When a hangup received, i am calling a script to calculate the bill and we
are trying to write the results to cdr database.

We added two fileds to cdr table as  rate and cost.

 

When we call a number and the other party doesnt hang up, rate (the targets
rate according to our rates table) and cost (calculated cost according to
rate and billable seconds) is written to database correctly.(sure cost is 0
because of hangup.)

 

But, if other party picks up the phone, and makes the call, even at debug of
php, i can see all the data correctly, it doesnt update the cdr fileds
correct.

 

Here is the php script output and cdr output of the calls.

 

No answer:

aftercall.php:     [agi_context] => DLPN_WorldcallDial

 aftercall.php:     [agi_extension] => h

 aftercall.php:     [agi_priority] => 2

 aftercall.php:     [agi_enhanced] => 0.0

 aftercall.php:     [agi_accountcode] =>

 aftercall.php:     [agi_threadid] => 139906110289680

 aftercall.php: >code<: 200

 aftercall.php: >result<: 1

 aftercall.php: >data<:

 aftercall.php: >code<: 200

 aftercall.php: >result<: 1

 aftercall.php: >data<: 0.04830

 aftercall.php: >>>>>>>>>>rate:0.04830

 aftercall.php: >>>>>>>>>>duration:

    -- AGI Script Executing Application: (set) Options: (CDR(userfield)=0)

    -- AGI Script Executing Application: (set) Options: (CDR(rate)=0.04830)

    -- AGI Script Executing Application: (set) Options: (CDR(cost)=0)

 aftercall.php: >>>>>>>>>>>>>>>>cost:0

    -- <SIP/10010-0000000c>AGI Script aftercall.php completed, returning 0

and at the cdr rate is filled as 0.04830 and cost is 0 as it should be.

 

This is answered state:

 

aftercall.php:     [agi_context] => DLPN_WorldcallDial

 aftercall.php:     [agi_extension] => h

 aftercall.php:     [agi_priority] => 2

 aftercall.php:     [agi_enhanced] => 0.0

 aftercall.php:     [agi_accountcode] =>

 aftercall.php:     [agi_threadid] => 139906110289680

 aftercall.php: >code<: 200

 aftercall.php: >result<: 1

 aftercall.php: >data<: 5

 aftercall.php: >code<: 200

 aftercall.php: >result<: 1

 aftercall.php: >data<: 0.04830

 aftercall.php: >>>>>>>>>>rate:0.04830

 aftercall.php: >>>>>>>>>>duration:5

    -- AGI Script Executing Application: (set) Options:
(CDR(userfield)=0.0483)

    -- AGI Script Executing Application: (set) Options: (CDR(rate)=0.04830)

    -- AGI Script Executing Application: (set) Options: (CDR(cost)=0.0483)

 aftercall.php: >>>>>>>>>>>>>>>>cost:0.0483

 

But the cdr rate and cost fields are both "0".

And this is the php scripts filed update part.

$agi->exec("set", "CDR(userfield)={$cost}");

$agi->exec("set", "CDR(rate)={$rateArray['data']}");

$agi->exec("set", "CDR(cost)={$cost}");

$agi->conlog(">>>>>>>>>>>>>>>>cost:". $cost);

-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.digium.com/pipermail/asterisk-users/attachments/20101120/f7c498e4/attachment.htm 


More information about the asterisk-users mailing list