Re: this thread which is sadly closed now, a Reddit user pointed me to a bash script which did the trick
Here’s the slightly modified script which works for PJSIP.
context="from-internal" # a destination context
exten=22 # an operator's number
num=23 # a destination number
bridge=$(asterisk -rx 'core show channels concise' | grep PJSIP/$exten | cut -d '!' -f13 ) # gets a channel bridge-id, where its name is like SIP/xx-aaaaa
channel=$(asterisk -rx 'core show channels concise' | grep $bridge | grep -v PJSIP/$exten- | cut -d '!' -f1) # gets a connected channel, where its name is $
result=$(asterisk -rx "channel redirect $channel $context,$num,1") # transfers an extracted channel into the destination context
This question begs some help. If the call isn’t established, you need to answer it in order to “pull it in” so the PBX can deal with it. One option would be to set up something like a repeating announcement and answer the call there. You aren’t going to be able to do anything with an unanswered call, but you can answer it in a ton of other places.
One hates to argue with results, but this script is a bit of a hack. The output from core show channels may be truncated depending on how many characters long your channels are, so your results will be inconsistent. The original script uses core show channels concise for this reason.
The Proper™ non-hack way to do this is to connect via AMI, query for the desired channel then send the redirect thru the AMI.
so (to me) it looks like when I execute the grep, the correct channel is extracted but is cut to Local/[email protected] instead of Local/FMGL-07511232121#@from-internal-000000a5;1 this doesn’t seem to happen with INTERNAL calls, which always seems to have the format
Figured it out! This script works for unanswered calls AND answered calls. It means I can tap a button on my wall tablet (which is next to the phone in my kitchen) and transfer calls if the caller ID is someone who really might be wanting to talk to my wife in the attic, or if, mid conversation, it turns out they need to talk to my wife in the attic. The mad woman in the attic.