Dial Pattern internally

We have a FreePBX 14.0.13.4 running well.
Now, I have made some Outbound Routes with Dial Patterns to enable users to make an outbound call with their own Caller ID, but from a different telephone set. They can predial for instance 30* and the their destination number, and their own personal caller id +xxxxxxx30 gets set instead of the one, that’s assigned to the telephone set they use.
So far it works.
Now, this doesn’t work, when they dial an internal number, because these seem not to get routed through the outbound routes. How can I achive, that it also works internally? So they can dial 30*14 and thus call extension 14 internally with caller id 30?

How many local extensions?

It should work generic on any current and future extensions.
I found a way now with a loopback trunk with Custom Dial String local/[email protected].
In extensions_custom.conf I put:

[outbound-allroutes-custom] ; Test
exten => _XX*XX,1,Macro(user-callerid,LIMIT,EXTERNAL,)
exten => _XX*XX,n,Gosub(sub-record-check,s,1(out,${EXTEN},dontcare))
exten => _XX*XX,n,ExecIf($[ "${CALLEE_ACCOUNCODE}" != "" ] ?Set(CDR(accountcode)=${CALLEE_ACCOUNCODE}))
exten => _XX*XX,n,Set(MOHCLASS=${IF($["${MOHCLASS}"=""]?default:${MOHCLASS})})
exten => _XX*XX,n,ExecIf($["${KEEPCID}"!="TRUE" & ${LEN(${TRUNKCIDOVERRIDE})}=0]?Set(TRUNKCIDOVERRIDE=<${EXTEN:0:2}>))
exten => _XX*XX,n,Set(_NODEST=)
exten => _XX*XX,n,Macro(dialout-trunk,4,${EXTEN:3},,off)
exten => _XX*XX,n,Macro(outisbusy,)

So, this does the trick. I just copied, what freepbx puts in extensions_additional.conf when making a manual outbound route in the web gui, and adjusted the pattern and replaced the part with TRUNKCIDOVERRIDE=<${EXTEN:0:2}>

Now I try to make the outbound routes I mentioned in the opening post to be also generic for every current and future extension. What I want is, that the outgoing Caller Id gets set to the original caller id of the telephone set used, but the last two digits replaced by the predialed extension code.
I.e., if I take the telephone assigned to extension 26, if i dial out xxxx, the caller Id is +49301234526. If I take the same telephone and dial out 30*xxxx, the Caller Id shall be +49301234530. I added this code:

exten => _XX*[0-9+]XX!,1,Macro(user-callerid,LIMIT,EXTERNAL,)
exten => _XX*[0-9+]XX!,n,Gosub(sub-record-check,s,1(out,${EXTEN},dontcare))
exten => _XX*[0-9+]XX!,n,ExecIf($[ "${CALLEE_ACCOUNCODE}" != "" ] ?Set(CDR(accountcode)=${CALLEE_ACCOUNCODE}))
exten => _XX*[0-9+]XX!,n,Set(MOHCLASS=${IF($["${MOHCLASS}"=""]?default:${MOHCLASS})})
exten => _XX*[0-9+]XX!,n,ExecIf($["${KEEPCID}"!="TRUE" & ${LEN(${TRUNKCIDOVERRIDE})}=0]?Set(TRUNKCIDOVERRIDE=<493012345${EXTEN:0:2}>))
exten => _XX*[0-9+]XX!,n,Set(_NODEST=)
exten => _XX*[0-9+]XX!,n,Macro(dialout-trunk,1,${EXTEN:3},,off)
exten => _XX*[0-9+]XX!,n,Macro(outisbusy,)

So far this works too. What bothers me, is that the number 493012345 is hardcoded in the conf (line 5). Is there a way to retrieve it from the trunk or from the extension Override-CID? Or somewhere else from?

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