Search code examples
asteriskfreepbx

Asterisk Freepbx - hide external number on user's display after forwarding


For some reason I can not find the necessary information on the Internet.

Subscriber A has set forwarding to an external number (output to the city goes through a sip trunk). I want this external number to be hidden for subscriber B, when he calls subscriber A.

How to implement?

Those. In my understanding there should be a condition:

If the call was forwarded and a call was made to a number that starts with _11X (exit to the city) Then perform the callerid replacement function. ####################################################################

Update:

Perhaps I explained incorrectly. For example, I call from number 2222 to number 3333 (these numbers are located on Asterisk). Call forwarding to mobile number 11444555566 is set on number 3333 (Calls to external numbers go through sip trunk to siemens)

So, when I call like this, I see that the call goes to number 3333, but when the mobile number 11444555566 answers, then I see this number 11444555566 on the my phone, but I would not want it to be visible on the display, because we consider mobile number information to be private.

And I would like to hide this number only if forwarding to numbers _11 is set

On FreePBX, I can make a custom dialplan in extensions_custom.conf, but I need a hint.

for example, I now have a simple dialplan for external outgoing calls in extensions_custom, i want to hide ${EXTEN} on the phone display:

[dial-siemens]
exten => _11.,1,Set(CALLERID(num)=${CALLERID(num)})
exten => _11.,n,Dial(PJSIP/${EXTEN}@Siemens,120)
exten => _11.,n,Hangup()

####################################################################

UPDATE:

I continued to look for a solution and something worked, but not completely. It turned out to remove the number from the phone display with such a dialplan setting, the I option helped.

exten => _11X.,1,Set(CONNECTEDLINE(num)=fwd to external)
exten => _11X.,n,Dial(PJSIP/${EXTEN}@Siemens,,I)
exten => _11X.,n,Hangup()

Now, when dialing an external number _11, I see "fwd to external" instead of the number. This is what I need.

Now I need to make the rule only run when the call has been redirected. Need help.


Solution

  • it seems to work like that:

    [dial-siemens]
    exten => _11X.,1,ExecIf($["${DB(CF/${CONNECTEDLINE(num)})}"!=""]?Macro(dial-siemens-cf-external,${EXTEN}),s,1)
    exten => _11X.,n,Dial(PJSIP/${EXTEN}@Siemens,120)
    exten => _11X.,n,Hangup()
    
    [macro-dial-siemens-cf-external]
    exten => s,1,Set(CONNECTEDLINE(num)=fwd to external)
    exten => s,n,Dial(PJSIP/${ARG1}@Siemens,,I)
    exten => s,n,Hangup()