[Freeswitch-dev] Add accountcode to Show Channels

Matt Riddell lists at venturevoip.com
Mon Sep 14 21:24:30 PDT 2009


I opened a bug with a patch (which admittedly will need some extra 
work), but wondered if I've maybe stepped on someone's toes, or if I 
should be approaching the problem in a different manner.

Basically what I'm trying to achieve is this:

(this particular implementation is to replace Asterisk for an emergency 
warning broadcast system)

1. Originate a call (with accountcode to specify which customer of a 
multi tenanted system should be billed).

2. Check how many calls the system currently has (broken down by 
accountcode so that I can restrict individual accounts).

I realise that I could keep a lookup table of UUID to customer on 
origination, but if we're doing thousands of calls in a short period of 
time the list would become huge (we're load balancing calls across 
multiple freeswitch machines), and I'd rather keep the data sent to/from 
each machine to a minimum.

So, in Asterisk the way we do it is "show channels concise"  which 
provides a list of channels with their details (much the same as 
freeswitch), but also provides the accountcode which allows me to group 
the calls.  By the way, the format for return from "show channels" is 
fantastic, the code on my side now looks at the header line once (the 
first time it checks channels) and compares each field to the list I 
expect.  This means that even if the order of the fields is different on 
different machines, I'll still get the expected results.

Anyway, so I put together a super small patch to add in the accountcode, 
but get the feeling that it's not useful.

It's available here:


I noticed that if you have a call originated by a softphone, the 
accountcode comes from the configs, and this gets passed to the show 
channels no problems.

However, if I set it in the originate, i.e.:

esl_send_recv(&ser->handle, "bgapi originate 
{variable_accountcode=bar}sofia/internal/1000%x.x.x.x 9999\n\n");

Then the accountcode is blank - maybe because it is initially set up 
without one and the variable is set later?

Anyway, so where to from here?

Should I keep working on it (I'd likely need some assistance, but am 
willing to do whatever it takes), or is there a better way to do it that 
I'm not seeing because of no0bness to FreeSwitch?

Thanks for your time.


Matt Riddell

http://www.venturevoip.com/news.php (Daily Asterisk News)
http://www.venturevoip.com/st.php (SmoothTorque Predictive Dialer)
http://www.venturevoip.com/c3.php (ConduIT3 PABX Systems)

More information about the FreeSWITCH-dev mailing list