Caller ID on outbound calls is set to <bad value>


I have the following setup:

Two servers: A (Active) and B (standby), manual failover/failback procedures.

HW and OS: HP ProLiant DL360 G5, RHEL 5.7
Asterik version:
FreePBX version:
FreePBX modules (2.9 latest):
extensionsettings, findmefollow, ivr, queueprio, queues, ringgroups, timeconditions, callforward, conferences, parking, asterisk-cli, asteriskinfo, backup, printextensions

FreePBX configuration:
SIP, IAX2 trunks, ~200 extensions, queues, conferences and custom dialpan.
FreePBX Backup:
Full daily, taken on server A.

The problem I have is when I failover to server B and restore the configuration from a FreePBX backup archive.
The outbound calls that are routed via the SIP/IAX2 trunks have the CID set to: < bad value > . This is also displayed at the called party’s telephone.
Note that all extensions are defined in FreePBX with an empty Outbound CID. Apart from this everything else works fine.

I have checked the dialplan and found that the first time the " < bad value > " string is assigned is when the following line of [macro-outbound-callerid] is processed:
exten => s,n(normcid),Set(USEROUTCID=${DB(AMPUSER/${AMPUSER}/outboundcid)})

The relevant message that appear in the command-line interface is similar to the following:
– Executing [[email protected]:6] Set(“IAX2/XXXXXXXX-9157”, "USEROUTCID= < bad value > ") in new stack

I have checked the internal asterisk database and confirmed that on both servers the outboundcid key is set to < bad value > , e.g.:
/AMPUSER/7000/outboundcid : < bad value >

The difference is that on server A the same line of the macro results to :
– Executing [[email protected]:6] Set(“IAX2/neutron2-9157”, “USEROUTCID=”) in new stack
In that case the CID displayed at the called party’s phone is proper.

I have come up with three workarounds for server B:
The first is to click on submit button for each extension configured on FreePBX.
The second is to delete all outboundcid keys from AstDB using a shell script.
The third is to set the outbound CID for all extensions to "name "

For the first two cases, if I click the submit button for an extension the outboundcid key is updated/created in AstDB and is set again to < bad value > .
Hoever, this time the CID displayed at the called party’s telephone is proper and the result on the macro is “USEROUTCID=”.

I understand that the problem is in the way the AstDB is restored from the backup. Somehow Asterisk thinks that the value of the specific key is actually set to " < bad value > ". Only after I re-submit the extension data from the FreePBX GUI, the AstDB handles the key value as a null string.

It would be really helpful if you have any suggestions to find a solution that doesn’t require manual intervention.

Thanks for any help you can give me.


Did you ever find any solutions to this? I have the same problem.

I had this and the quick way was doing a bulk extensions export and re-importing. And the values were restored properly …