Would u plz help me

i wrote an AGI script in php and in this script i’m trying to get the call duration in this script sometimes everything works ok but other times the result is zero in spite of i talk more than zero minutes so would u plz help me and by the way i’m using EyeBeam softphone
thx so much