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.
#!/bin/bash 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 echo $result exit 0