Help needed! Dialplan problem


I have been getting to grips with asterisk using trixbox and FreePBX. I’ve got a few custom contexts that my sip end points use.

The problem I have is that on certain calls, eg those made by SNAP plugin, have a blank accountcode in the CDR record.

What I’d like to do is correct this. To ensure that every outgoing call has an accountcode I’m thinking that I alter the freePBX dialout-trunk macro to include a check to see if the accountcode variable is empty. I’m ok with everything up until this point.

Here’s where I need help…

If the variable is emtpy how do I find the accountcode in sip.conf for the calling extension? I can’t see how I find that information out?? I think I need to query the Asterisk database for the answer but have no idea how to do it.

Any ideas anyone??? I’d be extremely grateful if someone could throw some light on this …

SNAP sens the call via the asterisk call manager. There is a way to set it bu the SET command. However I dont remember the variable name. Have a look on