We have an Asterisk 1.4.44 machine running here. For we are an ISP, we’re using the CDR billing which is working perfectly fine. So, happy happy here
But, as a company we’re always trying to get better and so is our VoIP-service. The newest idea we have now, is that if a customer’s account is offline, it will forward the incoming phonecall to an external nr. Doesn’t look hard, so… I build it and technically, it works… except for the CDR which sees the external phonecall in the wrong context (and thus, no billing)
Incoming phonecalls will land in the [macro-stdexten]. Outgoing phonecalls end in context [outgoing] which will connect to our loadbalanced peer(s) using a nifty macro.
Basically, the [macro-stdexten] looks like this (minus the other logging crap in front)
So, see priority 31 for what I’ve tried. Normal outgoing calls (to external) go to
Checknumber does nothing (used to do a who rewrite for the correct CLID). From checknumber it does a “Goto outgoing” where it will go to the macro safedial-proxy (which is only making sure of the userinput and if the nr is good) and then being Macro’d into load-balance where it will randomly select an outgoing peer.
Incoming calls are put in context ‘customer’, outgoing calls will be context ‘outgoing’. The trick I want is to get the incoming call basically moved to the other context. I know CDR(context) is a readonly var, so I cannot change that. The only thing which got the context right, is the Dial(Local/$FWSTRING@outgoing) line but I will have 2 entries in the MySQL CDR database (nothing customer there), one with context ‘customers’ which is not billable but will have the correct nr of seconds and the other one (Local/phonenr) only has like 9 seconds where there are 0 billable (???).
I’ve tried GotoIf, GosubIf and even a ResetCDR() but it just didn’t work at all.
What I’m I misseeing here or how can I transfer the incoming call to ‘customer-A’ to an outgoing call using accountcode ‘customer-A’ (that works btw). Any ideas about this?