This is a continuation of #3291, see previous for details
the new retrieve_op_conf_from_mysql.php derives trunk information from zapata.conf (or dahdi.conf) files along with looking through sip.conf and iax.conf (and included files). With the new trunks table added to 2.6, it would be cleaner and probably more simple to sue that table to generate all the trunk data. In addition, the trunks table has a descriptive name field that could also be used.
The one thing that needs to be examined is when to use the usercontext with sip and iax.
Another change would be to modify this so that it can be included vs. executed from retrieve_conf (similar to libfreepbx.confgen.php as was discussed in #3291). That gives the advantage of full access to all the api calls to list trunks, extensions, etc vs. hitting the table directly.
Examples and schema of the trunks table can be foudn in #3291.