i need help. I am using asterisk from source and using SIP. I am creating a web interface for users to view their outstanding credit. My webserver is seperate from the asterisk server. My problem is the creadit on the web interface does not show the real time amount right after the user hangs up. the user can only see the amount update when he tries to call again.
i have 3 AGI scripts thats being called when a user initiates a call.
first is “pre” pre calculates the amount of time a user can call base on his credit. (maxTimetoCall = credit / chargePerMinute)
second it goes to “recon” updates the credit base on the time consumed. (credit = credit - (CDR(billsec) / 60) * chargePerMinute)
-at this point the user ring the number. Dial(SIP/xxx)
when the user hangs up the third script executes.
third “post” posts the chargePerMinute of the call to the database.
(chargePerMinute = xxxxCountry-WhereTheUserIsPlacingACall)
it is obvious here that the first call did not reflect on the credit. However when the user calls again thats the time the “recon” updates the credit.
sounds like post isnt running. try adding the post script to the ‘h’ extension in whatever context you are in, that way it will run when every call is hung up…
ah, as i recall sometimes variables get lost when going to ‘h’…
you could also put another copy of the script after the Dial() entry…
or if the script is going off CDR its possible the CDR isnt getting written until after ‘h’ executes… you could do System() to call a shell script that forks and then runs the finish script after a few seconds (getting the account # from a command line argument)…