@dicko The copy/paste bandit strikes again.
The /n ânew lineâ was remnants from the code from the StackOverflow page that helped initially.
Once the â/nâ was removed, I could run the command successfully locally :
asterisk -rx "channel originate Local/callpaging@PlayDoorbellContext extension playsound-custom@PlayDoorbellContext"
Next, I took your suggestion of encapsulating the asterisk-specific string in the command with single quotes, and now I can successfully execute the command from a remote system:
ssh root@IPBXSYSTEM asterisk -rx '"channel originate Local/callpaging@PlayDoorbellContext extension playsound-custom@PlayDoorbellContext"'
To update everyone with the suggestions and changes, here is the updated functioning code:
[from-internal-custom]
;exten => 26669,1,Goto(PlayDoorbellContext,OriginateSound,1) ;Not used. Instead, I created Custom Destination combined with a Misc. Application with the FreePBX web interface.
;exten => 26670,1,Goto(PlayUSPSMailboxContext,OriginateSound,1) ;Not used. Instead, I created Custom Destination combined with a Misc. Application with the FreePBX web interface.
[PlayDoorbellContext]
exten => OriginateSound,1,Answer
exten => OriginateSound,2,System(asterisk -rx "channel originate Local/callpaging@PlayDoorbellContext extension playsound-custom@PlayDoorbellContext")
exten => OriginateSound,3,Hangup
;exten => callpaging,1,Set(CALLERID(name)=Doorbell) ;Some phones are configured not to accept anonymous calls, so I had to set callerid. This line is just to set the name. This line is not used.
exten => callpaging,1,Set(CALLERID(all)=Doorbell <PhoneSystem>) ;Some phones are configured not to accept anonymous calls, so I had to set callerid. This line sets both name and number fields and is used.
exten => callpaging,2,Page(Local/903@from-internal,i,q,n,5) ;Calls just my desk phone for testing.
;exten => callpaging,2,Page(Local/900@from-internal,i,q,n,5) ;Or, can use a paging/ring group (e.g. local/900@from-internal)
;exten => callpaging,2,Page(SIP/901&SIP/902&SIP/903&SIP/904&SIP/905&SIP/906&SIP/907&SIP/908,i,q,n,5) ;Or, can use multiple extensions by using "&"
exten => callpaging,3,Hangup
exten => playsound-custom,1,Answer ;This extension plays specific sounds over paging/intercom system
exten => playsound-custom,2,Wait(1)
exten => playsound-custom,n,Playback(custom/House-bell-sound-effect)
;exten => playsound-custom,n,Playback(custom/TOS_commwhistle)
exten => playsound-custom,n,Hangup
[PlayUSPSMailboxContext]
exten => OriginateSound,1,Answer
exten => OriginateSound,2,System(asterisk -rx "channel originate Local/callpaging@PlayUSPSMailboxContext extension playsound-custom@PlayUSPSMailboxContext")
exten => OriginateSound,3,Hangup
;exten => callpaging,1,Set(CALLERID(name)=Doorbell) ;Some phones are configured not to accept anonymous calls, so I had to set callerid. This line is just to set the name. This line is not used.
exten => callpaging,1,Set(CALLERID(all)=USPS Mailbox <PhoneSystem>) ;Some phones are configured not to accept anonymous calls, so I had to set callerid. This line sets both name and number fields and is used.
exten => callpaging,2,Page(Local/903@from-internal,i,q,n,5) ;Calls just my desk phone for testing.
;exten => callpaging,2,Page(Local/900@from-internal,i,q,n,5) ;Or, can use a paging/ring group (e.g. local/900@from-internal)
;exten => callpaging,2,Page(SIP/901&SIP/902&SIP/903&SIP/904&SIP/905&SIP/906&SIP/907&SIP/908,i,q,n,5) ;Or, can use multiple extensions by using "&"
exten => callpaging,3,Hangup
exten => playsound-custom,1,Answer ;This extension plays specific sounds over paging/intercom system
exten => playsound-custom,2,Wait(1)
exten => playsound-custom,n,Playback(custom/BlueCluesMail)
;exten => playsound-custom,n,Playback(custom/homermail_here)
exten => playsound-custom,n,Hangup
As suggested by @lgaetz, I created Custom Destinations in the FreePBX web interface:
And a Misc. Application to match via the FreePBX web interface:
Everything works great now! For now I am using EventGhost with a Hubitat port-over method that receives http messages from the Hubitat when a sensor is triggered. From there, it will play a sound over the paging/intercom system in the house depending on what sensor was triggered via the plink.exe application.
I did have to save public ssh keys on the FreePBX server in order for plink to execute the command(s) remotely.
Thank You Everyone for your help!! 

