extensions_custom.conf question


I am trying to check an asterisk DB value and if a specific value, perform an action, else continue.

I have the action being performed, when the action is triggered…
But when the IF is not matched the process continues (as it should), but all values of the caller seem to vanish and the call is then unkown (callerid is not set, etc…). All that seems to be known is the number dialed:

When ${DB(ACCOUNT/${CALLERID(num)})} value = 2, the process runs as expected.
When ${DB(ACCOUNT/${CALLERID(num)})} <> 2, then the caller details get lost.

Below is what I have in extensions_custom.conf
Any assistance is appreciated.

exten => _X.,1,GotoIf($["${DB(ACCOUNT/${CALLERID(num)})}"=“2”]?accountbill-status-suspend,s,1)

exten => s,1,Noop(“ACCOUNT CHECK ${CALLERID(num)} - Billing Status: ${DB(ACCOUNT/${CALLERID(num)})}”)
exten => s,n,Answer
exten => s,n,Wait(1)
exten => s,n,Playback(custom/suspended-wav&goodbye)
exten => s,n,Hangup
;end [accountbill-status-suspend]

Asterisk doesn’t include an extensions_custom.conf but FreePBX does. As your error case appears to be when this falls back to the FreePBX standard logic, you should ask on http://community.freepbx.org/

Try using true:false in your dialplan:


If your expression is true (value=2) then go to a destination if it’s false (value!=) then go to another.


exten => _X.,1,GotoIf($["${DB(ACCOUNT/${CALLERID(num)})}"=“2”]?account-status-ok,s,1:accountbill-status-suspend,s,1)

I don’t think if you intercept the call you can auto fall through to standard operation without knowing the context,extension,priority however you can send the call to account-status-ok and from there route it back to freepbx through dialplan

If the condition is true, all is good and it executes the condition and hangs up.
When the condition is not met is where my issue is.

Oddly, when the line is not there it flow properly, but when the line is there and and not executed (ie: false), it looses all the caller data.

Now the calls does auto fall through… but losses everything about the originating caller (shows as unknown) and the number out is the trunk id. The accountcode is still there, and the entry appears in in CDR with correct accountcode, just the CNUM/CNAM appear lost… not sure what else may be lost though too.

try using variable inheritance


As I said, this is a question for the FreePBX people. However, it is likely that if you fall off the end of custom dialplan, that the call will terminate and all state be lost. However, I can imagine tricks they could do to regain control of the call and it is possible that they analyse the dialplan and add a final priority, dynamically. All this is in their part of the system.