Change Caller ID for forwarded calls

Is it possible to change the presentation of a calling number when a call is forwarded through *72. I would like the target phone to display also the forwarding extension.

I added a diversion header for the CF calls. Yealink phones show it correctly.
It would be nice to have an option like add a diversion header for internal calls.

[macro-dialout-one-predial-hook]
exten => s,1,GotoIf($["${DIVERSION_REASON}" = "unconditional" & "${DEXTEN:-1}" = "#"]?setdiv)
same => n,GotoIf($["${DIVERSION_REASON}" != "unconditional" | ${ISNULL(${DIV_FROM})}]?quit)
same => n,Gosub(func-set-sipheader,s,1(Diversion,<sip:${DIV_FROM}@127.0.0.1>\;reason=${DIVERSION_REASON}))
same => n,MacroExit()
same => n(setdiv),Set(__DIV_FROM=${EXTTOCALL})
same => n(quit),MacroExit()

You shouldn’t need to directly set the Diversion header. Asterisk knows about them and should create them itself, if used correctly.

I only tried this once, and it was many years ago, on a raw Asterisk and I don’t think it was planned for production use, although I’m not sure on that last point. As such I can’t be sure that FreePBX doesn’t get in the way.

https://wiki.asterisk.org/wiki/display/AST/Manipulating+Party+ID+Information#ManipulatingPartyIDInformation-REDIRECTINGdialplanfunction

Thanks. I changed.

[macro-dialout-one-predial-hook]
exten => s,1,GotoIf($["${DIVERSION_REASON}" = "unconditional" & "${DEXTEN:-1}" = "#"]?setdiv)
same => n,GotoIf($["${DIVERSION_REASON}" != "unconditional" | ${ISNULL(${DIV_FROM})}]?quit)
same => n,Set(REDIRECTING(from-num,i)=${DIV_FROM})
same => n,Set(REDIRECTING(count,i)=$[${REDIRECTING(count)} + 1])
same => n,Set(REDIRECTING(reason,i)=cfu)
same => n,MacroExit()
same => n(setdiv),Set(__DIV_FROM=${EXTTOCALL})
same => n(quit),MacroExit()
1 Like

This topic was automatically closed 31 days after the last reply. New replies are no longer allowed.