Looking to get out of some work

Status
Not open for further replies.

bcmike

Active Member
Jun 7, 2018
339
58
28
54
Hi everyone,

I created a large amount of extensions without entering the emergency CID info. Is there any easy way to insert those fields without having to edit each extension? The emergency CID info will be the same for all extensions.

Thanks in advance.
 
A postgres query should be able to handle setting that, just make sure to scope it to the proper domain
 
Lets assume you want to do this for every extension in the domain, the SQL would be something like this:
Code:
update v_extensions set emergency_caller_id_number = '1234' where domain_uuid = '<domain_uuid>';

You can get the domain uuid with:
Code:
select domain_uuid from v_domains where domain_name = 'mydomain.co.uk';

I'm sure I don' t need to say, always make a backup before making changes to the database.

As a safety net, before running the update query, you could always issue a select query so you can see what would be affected by the update where clause. If there are too many records to look at you could do a count instead, to see if the numbers add up:
Code:
select * from v_extensions where domain_uuid = '<domain_uuid>';
--or
select count(*) from v_extensions where domain_uuid = '<domain_uuid>';

Once you have updated your database you will need to call reload_xml for the updates to take effect.

I'm not wanting to teach my grandmother to suck eggs, but I hope that helps.
 
  • Like
Reactions: bcmike
Depending on the day of week, mood, alcohol caffeine levels, and direction of the wind, I'll either use a db query like the one above or use the Bulk Account Settings app for changes like this.

My wife won't appreciate this antidote so I'll share it here. I was feeling frisky yesterday so I ran this untested query on 800 extensions. Not my best decision, but it worked great!
Code:
UPDATE v_follow_me
SET follow_me_caller_id_uuid = subquery.destination_uuid
FROM(
    SELECT e.extension_uuid, e.extension, e.outbound_caller_id_number,
        d.destination_uuid, d.destination_caller_id_number,
        e.follow_me_uuid, dom.domain_name, e.effective_caller_id_name
    FROM v_extensions as e
    LEFT OUTER JOIN v_destinations as d ON right(d.destination_caller_id_number,10) = '423' || e.extension
    LEFT OUTER JOIN v_domains as dom ON dom.domain_uuid = e.domain_uuid
) as subquery
WHERE v_follow_me.follow_me_uuid = subquery.follow_me_uuid
and v_follow_me.domain_uuid = '21e67aba-c863-492d-b4a5-555555555'
 
As always Adrian and Konrad come through. Super impressed, thanks guys!
 
Status
Not open for further replies.