Inbound Route DID Number field correct, conf files wrong

I have been clawing my way through PHP files trying to understand how this is happening. I am not necessarily looking for an answer (unless you have one) but hopefully someone either has seen this problem before or can point me to the right files(s) to figure out where this DID is being mangled.

I changed the phone number to protect our privacy.

If I enter 2677989900 into the “DID Number” field in Inbound Routes, click SUBMIT then APPLY CHANGES the number will be incorrectly written to extensions_additional.conf as the following:

exten => -1616979496,1,Set(__FROM_DID=${EXTEN})
exten => -1616979496,n,Gosub(app-blacklist-check,s,1)
exten => -1616979496,n,ExecIf($[ “${CALLERID(name)}” = “” ] ?Set(CALLERID(name)=${CALLERID(num)}))
exten => -1616979496,n,Set(__CALLINGPRES_SV=${CALLERPRES()})
exten => -1616979496,n,Set(CALLERPRES()=allowed_not_screened)
exten => -1616979496,n(dest-ext),Goto(ext-queues,4800600,1)

However! If I put a “_” before the number ("_2677989900") then I get this output:

exten => _2677989900,1,Set(__FROM_DID=${EXTEN})
exten => _2677989900,n,Gosub(app-blacklist-check,s,1)
exten => _2677989900,n,ExecIf($[ “${CALLERID(name)}” = “” ] ?Set(CALLERID(name)=${CALLERID(num)}))
exten => _2677989900,n,Set(__CALLINGPRES_SV=${CALLERPRES()})
exten => _2677989900,n,Set(CALLERPRES()=allowed_not_screened)
exten => _2677989900,n(dest-ext),Goto(ext-queues,4800600,1)

Adding a “_” implies to me a type-cast to a string rather than a numeric value. The ‘-’ in ‘-1616979496’ indicates to me the number has skipped some kind of sanity check and has been type-casted to an incorrect numeric type.

I have checked mysql->asterisk.incoming and verified the DID appears correctly. I also did a var_dump in libraries/extensions.class.php to confirm “functions add” is receiving the right DID but someplace further down the line it is mangled.

I can also confirm this DID is the only one out of 300 DIDs experiencing this problem. This scares the hell out of me because it means something is broken somewhere and I don’t want to wait until something much more serious breaks to find out how far the cancer has spread. I can’t reproduce this problem on any other FreePBX installation or even this installation. It seems to be limited to one specific number.

Thank you for any help you can provide.


[[email protected] ~]# php -v
PHP 5.3.3 (cli) (built: Jul 12 2013 20:21:47)
Copyright © 1997-2010 The PHP Group
Zend Engine v2.3.0, Copyright © 1998-2010 Zend Technologies
[[email protected] ~]# uname -a
Linux on 2.6.32-358.2.1.el6.i686 #1 SMP Tue Mar 12 21:42:46 UTC 2013 i686 i686 i386 GNU/Linux
[[email protected] ~]#

PHP 5.3 issue with how numbers are saved.

You need to update to FreePBX 2.11 as we put a work around in place for this PHP 5.3.3 bug

I thought it might be a problem with PHP. Do you by any chance know the bug report number for this particular issue? I can go look for it if you don’t have it easily available.

I cannot upgrade this machine because it contains some heavy customization and we have a policy of not upgrading version-to-version without a security justification. We always build a new box, migrate users to the new box in batches, test the new box then retire the old box. This takes years to do because we value stability above all else.

Why would the PHP bug report help you if you refuse to upgrade? To solve the issue you either need to upgrade FreePBX or upgrade to PHP higher than 5.3.3. The bug report that is linked to PHP is closed as fixed in 5.3.4(ish)

That is helpful. I was unaware it was limited to just 5.3.3.

I was hoping there was a change to FreePBX’s PHP file I could make to resolve this specific issue rather than upgrading the entire distro. If upgrading PHP to 5.3.4 will resolve the problem then that would be a better solution.

Thank you!

Well the problem with this particular issue is that it’s not “one” file. Its numerous files scattered all throughout FreePBX, since you are on 2.9 it would take us half a day just to tell you what to change, I advise you either downgrade or upgrade FreePBX