You can see how sound_action is natively used on some DLC units. For example attributes\abilities\aef\modal_ability\sp\sp_240mm_off_map_barrage. This ability will use sound_action to play the offmap artillery firing. To understand the paths and codes we need to open two archives:
Data.sga
data\game\speechtuning.lua
Open with notepad. This will tell you what the 3 letter codes are for.
Sound.sga
These are the paths that sound_action uses. They are .bsc files which I believe is a Visual Studio file although we can open and view them partially with notepad. The files referenced are located in soundhigh.sga/soundlow.sga? but we don't really have to dig that deep. I think they are just variations of sound types.

So as an example we will make any unit produce the Soviet engineer 203 ability sound. Let's break down what the file path means.
speech\mp\soviet\eng\orderconfirmations\ability\sb_eng_abt_203gen_lt_s
sb: The speechtuning.lua file refers to it as "Soviet Building" but I think this may be for a race indicator. For example US, Brit, and Sov all have "eng" units but this code is different for each race. OST/OKW share xb for some reason.
eng: Combat Engineers. 3 letter code for the unit. Refer to speechtuning.lua
abt: Ability. Type of action.
203: Name of the ability or action.
gen: General. There are specific variations for some speech codes. Take a look at speech\mp\german\gre\orderconfirmations\ability\ to see the Panzerfaust codes for different vehicle types.
lt: Loud/normal talking? Don't know what the abbreviation is but lt is yelling, nt is talking.
s: Size? l/m/s are in this field.
As mentioned before there are some issues and limitations with using this. You will not be able to get a perfect system for imitating speech.
- Sound origin is centered in the middle of the map. But maybe it's because I put the action on a unit. Offmap artillery will sound the same no matter where the screen is on the map, speech will have radio sounds if off screen.
- Sounds will only play for the executing player.
- Some sounds don't work. I tried to get thunder sounds but nothing happened.
- Because these are played through actions and not through native systems it may be difficult to detect when to play sounds for certain actions.
Sound_action can of course be used for many other things other than speech. Hopefully you can find good uses for them.