In fact, the *37 feature code already works on external channels, but the dialplan bails if no valid ampuser is found from the channel name.
It’s actually not difficult to preserve the AMPUSER value on the external channels, I’ve updated post 1 to do this. In its present form I am able to:
- Answer a call on my local extension
- flip the call to a group of numbers using FMFM
- answer the call on my mobile
- flip the call back to the same group of numbers
EDIT: There is a better way to do this though, I’m reverting the change to post 1
Here is my work in progress:
[move-active-call]
exten => s,1,Noop(Entering user defined context move-active-call in extensions_custom.conf)
exten => s,n,DumpChan ; uncomment for debug
; get ampuser from initiating channel but skip if we have we run this gosub before
exten => s,n,GotoIf($["${LEN(${MOVING_AMPUSER})}"!="0"]?skip)
exten => s,n,GotoIf($["${LEN(${PICKUPMARK})}"!="0"]?skip)
exten => s,n(continue),Gosub(get-AMPUSER-from-asterisk-channel,s,1(${DYNAMIC_WHO_ACTIVATED}))
exten => s,n,ExecIf($["${GOSUB_RETVAL}"=""]?Return) ; abandon if no matching ampuser is found, also works for security as won't work for external channels
exten => s,n,Set(MOVING_AMPUSER=${GOSUB_RETVAL}) ; preserve result for downstream channels
exten => s,n(skip),Noop(Trying to move ${BRIDGEPEER} to another device for extension ${MOVING_AMPUSER})
; Originate call to all local devices, they will ring for 15s
exten => s,n,Originate(Local/${MOVING_AMPUSER}@originate-skipvm,exten,move-active-call,take_call,1,15,ac(${CALLERID})v(bp=${BRIDGEPEER}^__MOVING_AMPUSER=${MOVING_AMPUSER}))
exten => s,n,Return
exten => take_call,1,Noop(Bridging the call)
exten => take_call,n,Bridge(${bp},x)