Removing spaces from outbound phone numbers

I’m using the MicroSIP application as my desktop softphone which overall works well.

But if I click a number on a website with spaces in, as most do for the UK as it’s easier to read, MicroSIP takes this as “01484%20810%20711” where %20 is a space. I’ve already emailed them about this behaviour.

The call of course fails. Checking the Asterisk logs shows the %20 does get converted to spaces, so in the logs it shows as “01484 810 710”.

This thread:

Recommended the following to be inserted in to the extensions_custom.conf file. I have done this and reloaded, but it does not work. The post is from 2016 though.

[macro-dialout-trunk-predial-hook]
;Remove spaces or dashes or + from outbound number when calling
exten => s,1,Set(OUTNUM=${FILTER(0123456789*#,${OUTNUM})})
exten => s,n,MacroExit()

Googling shows only two other threads about removing spaces or characters, and other than renaming “macro” to “sub” after seeing a depreciation warning in the logs, I’m lost with how I could make this work in today’s version of FreePBX.

Any assistance appreciated <3

Hooking for fun and income - FreePBX / Tips and Tricks - FreePBX Community Forums

[macro-dialout-trunk-predial-hook]
exten => s,1,NoOp(Entering user defined context macro-dialout-trunk-predial-hook in extensions_custom.conf)
;Remove spaces or dashes or + from outbound number when calling
exten => s,n,Set(OUTNUM=${FILTER(0123456789*#,${OUTNUM})})
exten => s,n,MacroExit

Remember to reload dial plan.

@comtech Unfortunately that one still isn’t working for me. I did a dial plan reload and a full reboot too, and I’m still getting spaces in the logs :open_mouth:

Provide a log of the call.

Providing Great Debug - Support Services - Documentation (freepbx.org)

Asterisk logs from GUI: (I terminated the call during the error message playback)

2[2023-06-27 02:52:18] VERBOSE[6492] netsock2.c: Using SIP RTP Audio TOS bits 184
3[2023-06-27 02:52:18] VERBOSE[6492] netsock2.c: Using SIP RTP Audio TOS bits 184 in TCLASS field.
4[2023-06-27 02:52:18] VERBOSE[6492] netsock2.c: Using SIP RTP Audio CoS mark 5
5[2023-06-27 02:52:18] VERBOSE[9508][C-00000003] pbx.c: Executing [01484 810 710@from-internal:1] ResetCDR("PJSIP/103-00000002", "") in new stack
6[2023-06-27 02:52:18] VERBOSE[9508][C-00000003] pbx.c: Executing [01484 810 710@from-internal:2] NoCDR("PJSIP/103-00000002", "") in new stack
7[2023-06-27 02:52:18] VERBOSE[9508][C-00000003] pbx.c: Executing [01484 810 710@from-internal:3] Progress("PJSIP/103-00000002", "") in new stack
8[2023-06-27 02:52:18] VERBOSE[9508][C-00000003] pbx.c: Executing [01484 810 710@from-internal:4] Wait("PJSIP/103-00000002", "1") in new stack
9[2023-06-27 02:52:19] VERBOSE[9508][C-00000003] pbx.c: Executing [01484 810 710@from-internal:5] Playback("PJSIP/103-00000002", "silence/1&cannot-complete-as-dialed&check-number-dial-again,noanswer") in new stack
10[2023-06-27 02:52:19] VERBOSE[9508][C-00000003] file.c: <PJSIP/103-00000002> Playing 'silence/1.ulaw' (language 'en_GB')
11[2023-06-27 02:52:20] VERBOSE[9508][C-00000003] file.c: <PJSIP/103-00000002> Playing 'cannot-complete-as-dialed.ulaw' (language 'en_GB')
12[2023-06-27 02:52:23] VERBOSE[9508][C-00000003] file.c: <PJSIP/103-00000002> Playing 'check-number-dial-again.ulaw' (language 'en_GB')

From call event logging:


TimeTue, 27 Jun 2023 02:52
Event TypeHANGUP
UniqueID1687834338.2
LinkedID1687834338.2
Cid num103
Extensionh
Contextfrom-internal
Channel NamePJSIP/103-00000002
TimeTue, 27 Jun 2023 02:52
Event TypeCHAN_END
UniqueID1687834338.2
LinkedID1687834338.2
Cid num103
Extensionh
Contextfrom-internal
Channel NamePJSIP/103-00000002
TimeTue, 27 Jun 2023 02:52
Event TypeLINKEDID_END
UniqueID1687834338.2
LinkedID1687834338.2
Cid num103
Extensionh
Contextfrom-internal
Channel NamePJSIP/103-00000002
TimeTue, 27 Jun 2023 02:52
Event TypeCHAN_START
UniqueID1687834338.2
LinkedID1687834338.2
Cid num103
Extension01484 810 710
Contextfrom-internal
Channel NamePJSIP/103-00000002

The call doesn’t show in the CDR reports, but some Googling suggests it doesn’t log incomplete calls by default and I can’t find how to change this, the suggestion to edit cdr.conf doesn’t seem to apply now.

Are there more log entries for C-00000003 on the full log?

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