Wednesday, September 18, 2013

List entities of an ICM script



USE ccc_awdb
SELECT scr.*,
CASE(scr.TargetType)
WHEN 1 THEN 'Service'
WHEN 2 THEN 'Skill_Group'
WHEN 3 THEN 'Agent'
WHEN 4 THEN 'Translation_Route'
WHEN 7 THEN 'Call_Type'
WHEN 8 THEN 'Enterprise_Service'
WHEN 14 THEN 'Peripheral'
WHEN 16 THEN 'Trunk_Group'
WHEN 17 THEN 'Route'
WHEN 20 THEN 'Master_Script'
WHEN 33 THEN 'Network_Vru_Script'
WHEN 37 THEN 'Expanded_Call_Variable'

END AS Type,
CASE(scr.TargetType)
WHEN 1 THEN (SELECT EnterpriseName FROM Service WHERE SkillTargetID = scr.ForeignKey)
WHEN 2 THEN (SELECT EnterpriseName FROM Skill_Group WHERE SkillTargetID = scr.ForeignKey)
WHEN 3 THEN (SELECT EnterpriseName FROM Agent WHERE SkillTargetID = scr.ForeignKey)
WHEN 4 THEN (SELECT EnterpriseName FROM Translation_Route WHERE SkillTargetID = scr.ForeignKey)
WHEN 7 THEN (SELECT EnterpriseName FROM Call_Type WHERE CallTypeID = scr.ForeignKey)
WHEN 8 THEN (SELECT EnterpriseName FROM Enterprise_Service WHERE EnterpriseServiceID = scr.ForeignKey)
WHEN 14 THEN (SELECT EnterpriseName FROM Peripheral WHERE PeripheralID = scr.ForeignKey)
WHEN 16 THEN (SELECT EnterpriseName FROM Trunk_Group WHERE TrunkGroupID = scr.ForeignKey)
WHEN 17 THEN (SELECT EnterpriseName FROM Route WHERE RouteID = scr.ForeignKey)
WHEN 20 THEN (SELECT EnterpriseName FROM Master_Script WHERE MasterScriptID = scr.ForeignKey)
WHEN 33 THEN (SELECT EnterpriseName FROM Network_Vru_Script WHERE NetworkVruScriptID = scr.ForeignKey)
WHEN 37 THEN (SELECT EnterpriseName FROM Expanded_Call_Variable WHERE ExpandedCallVariableID = scr.ForeignKey)
END AS EnterpriseName
FROM Master_Script ms
INNER JOIN Script s ON s.MasterScriptID = ms.MasterScriptID AND s.Version = ms.CurrentVersion
INNER JOIN Script_Cross_Reference scr ON scr.ScriptID = s.ScriptID
WHERE ms.EnterpriseName = 'NM_AkviziceEL'

Friday, July 19, 2013

[Grails] Use Domain.withNewSession instead of refresh()

Waaaaaaay faster.
For instance, if you have a service run by a scheduled recurring Quartz job, the service seem to be attached to a thread which does not see the updated fields in the database (always returns cached values). We may refresh the whole domain calling the refresh() method on the domain class instance, or just do this:

def allCampaigns
        Campaign.withNewSession{ session ->
            allCampaigns = Campaign.findAll("from Campaign where myStatus IN ('active','paused') OR myStatus = null")
        }


Saturday, July 6, 2013

Cleaning up /boot


dpkg --get-selections|grep 'linux-image*'|awk '{print $1}'|egrep -v "linux-image-$(uname -r)|linux-image-generic" |while read n;do apt-get -y remove $n;done
 
 

Monday, May 27, 2013

Blocking one calling to one called

!
voice translation-rule 1001
 rule 1 reject /17771238001/
!
voice translation-profile 1001
 translate calling 1001
!
!incoming dial-peer 4 all
dial-peer voice 1 pots
 incoming called-number .
 direct-inward-dial
!
!incoming dial-peer special
dial-peer voice 1001 pots
 call-block translation-profile incoming 1001
 incoming called-number 0012021111001
 direct-inward-dial
!
!outgoing dialpeer to CUCM
dial-peer voice 9000 voip
 destination-pattern 0012021111...
 session target ipv4:192.168.210.11
 no vad