Delete dash to dial

hello
wanna remove dash using dialplan to make call out, i was found this but no working, what wrong PLZ

[my-test]

exten => _+216XXXXXXXX.,1,Set(CALLERID(num)=1000)
same => n,Set(OUTNUM=${EXTEN})
same => n,Macro(dialout)
same => n,Dial(SIP/trunk_1/${OUTNUM})
same => n,Hangup()

[macro-dialout]
exten => s,1,Verbose(“MACRO TEST”)
exten => s,n,Set(OUTNUM=${FILTER(+0123456789,${OUTNUM})})
exten => s,n,MacroExit()

Cli return

[May 11 01:00:24] NOTICE[64033][C-00000047]: chan_sip.c:26828 handle_request_invite: Call from ‘780’ (10.152.1.3:57621) to extension ‘+216 510 30 07 45’ rejected because extension not found in context ‘my-test’.

Thks for HLP

On Saturday 11 May 2024 at 03:22:54, darakss via Asterisk Community wrote:

exten => _+216XXXXXXXX.,1,Set(CALLERID(num)=1000)

Call from ‘780’ (10.152.1.3:57621) to extension ‘+216 510 30 07 45’ rejected
because extension not found in context ‘my-test’.

Your probem is that the pattern “_+216XXXXXXXX.,” matches a plus sign, the
digits 2, 1, 6 then eight more DIGITS, followed by anything.

X means “any digit 0 to 9”.

This cannot match the number you dialled, which is plus, 2, 1, 6 followed by
space. (Nor can it match anything including a dash, as in your subject line).

If you want ${EXTEN} to match spaces you have to allow for that in the
pattern: “_+216[0-9 ].” for example.

See Pattern Matching - Asterisk Documentation

Antony.


Success is a lousy teacher. It seduces smart people into thinking they can’t
lose.

  • William H Gates III

                                                Please reply to the list;
                                                      please *don't* CC me.
    
1 Like

its work fine, thk you a lot

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