How do I intercept all call after hangup


#1

Where can I intercept all outbound calls after they hang up?

I wrote a script to login to my voipjet account and check the balance. I’ve got an extension that I can call that will tell me the balance. I want to now check all outbound calls that were sent on my voipjet channel after the call and check the balance so that I can do certain actions when it gets low and needs replenishing. (like start sending myself nasty emails or something).

Thanks for the help. (And if you are interested in the script, let me know I can send it to you).

p


#2

yes. please do! this is something i was toying with. two ways i can think of to do this:

  1. a hack - custom script that watches the cdr_csv file to see when i changes. and runs the script (yuck…) slightly less gross: a cron job that runs daily and if the balance is less than X, emails a specific user.

  2. a hook into the * macros or somesuch that runs your script after a call using voipjet completes. when triggered, it does the same balance check as in #1 above.


#3

I just don’t know which macro(s) to hook. I thought it would go through the hangupcall macro but that doesn’t seem to always be the case. I figured I could put an h extension at the appropriate place. I’m hoping someone can point me at the right place to check this.

Doing a daily cron job to check on things wouls be trivial. I’m more interested in learning where to intercept the hangup for sakes of better understanding this than a real need. (Plus - I could then compare the balance to the balance before the call and actually tack on the exact amount for each call either in the CDR user field, or in another table with a reference back to this cdr.

I’m guessing there is somewhere this can be hooked in the dial plan and it doesn’t require actually hooking into the cdr code?

so - any knowledgable folks out there, let me know - as mentioned, I’ll be glad to make the script I have now available which is easily adapted to this or any other use for going onto voipjet’s account and getting your balance.

p


#4

using extension h seems good place to start. make your DeadAgi script so you can get the info you can use, to refer to your voipjet like, the destination channel name.


#5

OK - I was being dumb. It does got to the macro-hangupcall. For some reaon, it was just not printing out my Noop() messages when I was testing it.

So - now that I can do that, I’ve updated my script described. In addition to the the voiceprompt indicating the remaining balance, there is another script that:

  1. checks after the call and sends out email upon low balance condition
  2. updates a db table with the cost of the call just completed (can be joined with the CDR table)

p