[asterisk-users] Account Code Inbound

Peder peder at networkoblivion.com
Tue Dec 22 11:37:09 CST 2009


I am trying to track inbound and outbound calls by user.  In sip.conf, I can
add an account code so that all outbound calls from user1 have that as the
accountcode in CDR, so that works fine.  For inbound, if someone calls user1
direct, I can set the account code in the dial plan like this and it works
fine:

exten => 700,1,Set(CDR(accountcode)=BOB)
exten => 700,2,Dial(SIP/BOB)

The problem is if a calls comes in and rings several phones at once, there
is no way to set the account code for each user that I can see.  Does
anybody have any idea on how to do this?  Here is an example:

exten => 799,1,Dial(SIP/BOB&SIP/MARY&SIP/DAVE&SIP/TOM)


To get the data I could just search by destination number of BOB, but in the
example above the destination number in the CDR is 799, not BOB since that
is the number called.  I could also search dstchannel as that will show what
I want, but I was hoping there was a more generic way to do it (my dialplan
is a lot more complex than that listed above and each user has 3-4 lines
like 799-BOB, 798-BOB, 797-BOB, so a query to find all of the calls for BOB
gets ugly very quickly).

Peder





More information about the asterisk-users mailing list