Prefix in Caller ID for Custom Extension

Hi,
I need little help please.

I have a custom extension that dials out to my mobile, my VOIP provider allows me to pass Caller ID of actual caller. However I am having a problem, when people call my PBX and the call is diverted to my mobile, I cant make out whether the call is made on my mobile itself or the PBX.

Following is the custom extension

exten => 2001,1,Set(__RINGTIMER=${IF($[${DB(AMPUSER/2001/ringtimer)} > 0]?${DB(AMPUSER/2001/ringtimer)}:${RINGTIMER_DEFAULT})})
exten => 2001,n,Macro(exten-vm,novm,2001,0,0,0)
exten => 2001,n(dest),Set(__PICKUPMARK=)
exten => 2001,n,Goto(${IVR_CONTEXT},return,1)
exten => 2001,hint,SIP/MYVOIP/447123456789&Custom:DND2001

I have tried to set CallerID by adding 2 lines

exten => 2001,n,Set(CALLERID(num)=9${CALLERID(num)})
exten => 2001,n,Set(CALLERID(name)=${CALLERID(num)})

just above the

exten => 2001,hint,SIP/MYVOIP/447123456789&Custom:DND2001

but it doesn’t help

Thanks for assistance.

Okay I have got it working, with help of follow me. However there’s a small problem.

What I have done to get it working is, I have added a mobile number in follow-me settings of a Local extension also in that follow me I have added a prefix 99, then in extensions_additional.conf I changed the line exten => 2001,n,Macro(prepend-cid,99) to exten => 2001,n,Macro(prepend-cid-num,99) also in same conf I added a new context as following :

[macro-prepend-cid-num]
exten => s,1,GotoIf($["${RGPREFIX}" = “”]?REPCID)
exten => s,n,GotoIf($["${RGPREFIX}" != “${CALLERID(num):0:${LEN(${RGPREFIX})}}”]?REPCID)
exten => s,n,Set(CALLERID(num)=${CALLERID(num):${LEN(${RGPREFIX})}})
exten => s,n,Set(_RGPREFIX=)
exten => s,n(REPCID),Set(_RGPREFIX=${ARG1})
exten => s,n,Set(CALLERID(num)=${RGPREFIX}${CALLERID(num)})

;–== end of [macro-prepend-cid-num] ==–;

The problem is, every time I restart the Asterisk this conf is obviously rewritten to its original file and I loose this custom context. How can I solve this? Please help me :frowning:

Use the __custom file or the extensions___override file instead editing the additional config file.

Okay the extensions_additional.conf has the following context

[macro-prepend-cid]
include => macro-prepend-cid-custom
exten => s,1,GotoIf($["${RGPREFIX}" = “”]?REPCID)
exten => s,n,GotoIf($["${RGPREFIX}" != “${CALLERID(name):0:${LEN(${RGPREFIX})}}”]?REPCID)
exten => s,n,Set(CALLERID(name)=${CALLERID(name):${LEN(${RGPREFIX})}})
exten => s,n,Set(_RGPREFIX=)
exten => s,n(REPCID),Set(_RGPREFIX=${ARG1})
exten => s,n,Set(CALLERID(name)=${RGPREFIX}${CALLERID(name)})
;–== end of [macro-prepend-cid] ==–;

And extensions_custom.conf has the following one.

[macro-prepend-cid-custom]
exten => s,1,GotoIf($["${RGPREFIX}" = “”]?REPCID)
exten => s,n,GotoIf($["${RGPREFIX}" != “${CALLERID(num):0:${LEN(${RGPREFIX})}}”]?REPCID)
exten => s,n,Set(CALLERID(num)=${CALLERID(num):${LEN(${RGPREFIX})}})
exten => s,n,Set(_RGPREFIX=)
exten => s,n(REPCID),Set(_RGPREFIX=${ARG1})
exten => s,n,Set(CALLERID(num)=${RGPREFIX}${CALLERID(num)})

;–== end of [macro-prepend-cid-custom] ==–;

Still the caller ID sent is without the additional prefix of 99 :frowning:

Pls assist.

Maybe I missed something, but why not just use Follow-Me to ring your cell phone with Confirmation turned on? That way you would ALWAYS know if the call from from the PBX or direct dialed, you’d still have the original caller ID, and you’d have the option of ignoring the call if you want and still getting your work VM instead of her personal VM from the cell phone.

Did I miss the reason to customize the system instead?

PS, using DISA would allow you to also place calls to your customers and have those calls come from your company PBX and not your personal cell number even when calling from your cell. That way they get the correct caller ID too.

Okay the reason why I opted to change the CallerID is to be at a benefit of looking at the CLI and deciding whether it needs to be answered or not. For confirmation to work I would still need to answer the call, which would charge me voip (if im not wrong) + if in meetings I really wouldn’t want to do that. Moreover I want the call to loop back to the same queue maintaining its hold time in the queue, in case if I don’t answer, which works currently, unsure if it would work with confirmation.

okay I got it working. I just added the following context to extensions_overide_freepbx.conf

Thanks navaismo

[macro-prepend-cid]
exten => s,1,GotoIf($["${RGPREFIX}" = “”]?REPCID)
exten => s,n,GotoIf($["${RGPREFIX}" != “${CALLERID(num):0:${LEN(${RGPREFIX})}}”]?REPCID)
exten => s,n,Set(CALLERID(num)=${CALLERID(num):${LEN(${RGPREFIX})}})
exten => s,n,Set(_RGPREFIX=)
exten => s,n(REPCID),Set(_RGPREFIX=${ARG1})
exten => s,n,Set(CALLERID(num)=${RGPREFIX}${CALLERID(num)})

;–== end of [macro-prepend-cid] ==–;

Okay the reason why I opted to change the CallerID is to be at a benefit of
looking at the CLI and deciding whether it needs to be answered or not. For
confirmation to work I would still need to answer the call, which would
charge me voip (if im not wrong) + if in meetings I really wouldn’t want to
do that. Moreover I want the call to loop back to the same queue
maintaining its hold time in the queue, in case if I don’t answer, which
works currently, unsure if it would work with confirmation.