Importing 450 new DIDs and need each to have Superfecta CallerID enabled

We have a new client that has 450 DIDs. We use Superfecta Caller ID (SCID) for CID services. There is no method of telling the bulk handler that we want SCID for a number. Usually, we import a DID and then go back and modify it to have SCID. But with 450 DIDs, that is a lot of manual clicking.

Any suggestions?

This post had a solution, but I found that the original code needed a small tweak to get it to work. Here is my version that is working on FreePBX 16. Just run it to have it enable Superfecta for all existing DIDs in FreePBX.

#!/usr/bin/python
import MySQLdb

db = MySQLdb.connect(host="localhost",
                     db="asterisk")

# Create a Cursor object to execute queries.
cur = db.cursor()

# Select inbound route extension that don't exist in the superfecta table
cur.execute("select extension,cidnum from incoming where extension not in (select extension from superfecta_to_incoming);")

# Loop over and insert them
for row in cur.fetchall() :
        print row[0], " ", row[1]
        sql = "INSERT INTO superfecta_to_incoming (extension, cidnum, scheme) VALUES (%s, %s, %s)"
        val = (row[0], row[1], "ALL|ALL")
        print val
        cur.execute(sql, val)

db.commit()

This topic was automatically closed 31 days after the last reply. New replies are no longer allowed.