Diversion Header Problem

dear team,

i have activated the diversion headers (my provider needs this).
my extension 10 is forwarded directly on the phone, to a external PSTN.
if i call from external my extension 10, all working fine and the external phone rings.

if i call from internal 20 extension the 10 extension, my provider blocks the call because wrong CID.
have viewed on my sip header, here is the follwing Diversion:
Diversion: < sip : 10 @MYIPADDRESS > ; reason = unconditional

So if i set the follwing in the [macro-dialout-trunk-predial-hook]:
exten => s,1,SIPAddHeader(Diversion: < sip : [email protected] MYIPADDRESS >

all working fine. but i cant leave them so, because each call marked as “forwarded call”.

how i can tell freepbx that he should write the full caller id into the diversion?
or can i check if a diversion header was set from freepbx, and can i rewrite them?
any ideads?

thank you very much.

many greets

I would suggest you shouldn’t let the phone do the forward, use a ‘follow me’ instead

What version of FreePBX are you using? I have gone through the code that triggers diversion header; in 13 it looks like this:

 GosubIf($[${LEN(${FROM_DID})}>0 & "${FROM_DID}"!="s"]?sub-diversion-header,s,1())

The diversion header only gets written with the FROM_DID channel variable, and as far as I can tell, FROM_DID only gets set on inbound calls. I don’t see any way for a local extension to originate a call using a FROM_DID set to the local extension number.

hello dicko,

thank you. but how i can do that?
any command? so how i see, i have currently active on my phone is “transfer” without any code.
but what is the speed code for redirection? can i do that on the phone? or not?

thank you

Follow-me is part of the gui And can be linked to from the extension page , and well further documented in the wiki and hover-over help in the gui. As @lgaetz showed you are asking for something that is covered otherwise, if a follow-me number is appended with a # then it is treated differently and the calling party’s cid is used not the local extention that is not actually being forward but ‘found and followed’ , ihis wiuld presumably be honored by ypour carrier ss a valid headee.

So perhaps try it that wsy and use your button to send the feature code to toggle the fmfm state and indicate it’s current status