I have a PJSIP trunk setup between two FreePBX 15 systems. trunk works perfectly for all scenarios the users need except one, Find Me/Follow Me.
Normally, calling from extension 121 to extension 5120 shows the CID of 121 on the screen for 5120. But when 5120 has their FMFM active to their cell phone, the call fails because almost no carriers allow invalid CID to be sent any more.
The problem is than a route marked intra-company drops all other CID info except the local CID info.
@lgaetz told me to check out this post for the same thing related to an IAX trunk.
Well that logic makes sense, but what can I do with a PJSIP trunk to pass the info? Setting a SIP header is easy enough, but then I need to know how to read it on the other side during the inbound call handling. Is there some other variable I can use that would hang around like the IAXVAR does?
Knowing we are going out an intra-company trunk is easy. Added a pjsip header was easy. I can confirm on the inbound call I see the header.
[macro-dialout-trunk-predial-hook]
exten => s,1,NoOp(Entering user defined context [macro-dialout-trunk-predial-hook] in extensions_custom.conf)
; Determine if call is on an intra-company route or not
exten => s,n,GotoIf($["${INTRACOMPANYROUTE}"="YES"]?intra_call:pstn_call)
; This is an intracompany call note the outbound CID in the sip header X-OUTBOUND-CID
exten => s,n(intra_call),Noop(This call uses an Intra-Company route)
; If the calling extension has an outbound CID specified, use it
exten => s,n,ExecIf($[${DB_EXISTS(AMPUSER/${AMPUSER}/outboundcid)}]?Set(x_out_cid=${DB(AMPUSER/${AMPUSER}/outboundcid)}))
; If there was no CID found, get the CID specified on the outbound route (yes labeled TRUNKCIDOVERRIDE when found in the route)
exten => s,n,ExecIf("${x_out_cid}"=="")?Set(x_out_cid=${TRUNKCIDOVERRIDE}))
; Add the result as a sip header, change to variable?
exten => s,n,GoSub(func-set-sipheader,s,1(X-Outbound-CID,${x_out_cid}))
exten => s,n,goto(exit_macro)
; This is not an intra-company call. Check for the outbound CID to have been sent along
exten => s,n(pstn_call),NoOp(This call is heading for the PSTN)
;exten => s,n, ;what to do here is the question.
; <snip> unrelated code for setting a header specific to a sip provider </snip>
exten => s,n(exit_macro),MacroExit()