BT DID via 3102 remove - and ,

Many moons ago I asked the same question, and now having just moved my very old Freepbx (pi1) over to a Proxmox VM I’ve found same same old problem. The problem is numbers come in with added - and , eg ,0800-1234567 this messes up any routing.

I used to use this added to extensions_custom.conf but it no longer works, it could be I use pjsip to talk to the 3102 but don’t really know.

How do I do this now ?

[from-trunk-LLBT2]
exten => _X!,1,set(CALLERID(number)=${REPLACE(CALLERID(number), ,)})
exten => _X!,n,set(CALLERID(number)=${REPLACE(CALLERID(number),-,)})
exten => _X!,n,Set(CALLERID(number)=${IF($[ ${CALLERID(number)} = LLBT2]?00000:${CALLERID(number)})})
exten => _X!,n,noop(CALLERID is now ${CALLERID(all)})
exten => _X!,n,Goto(from-trunk,${EXTEN},1)

It looks like I got the above from @dicko ? in 2013 ish.

Verbose level 3 logs would help understand what is happening, as would an explanation of “does not work”.

Does the request URI start with a digit from 0 to 9?

Can the caller ID number be empty?

chan_pjsip should be irrelevant.

Since you are already trusting the value not to contain anything dangerous, FILTER might be a better way of cleaning it up.

1 Like

number is not a documented option for this function, although it might well be an undocumented synonym for num.

1 Like

Sorry about that, I posted a bit quickly with scant details.

Looking at the CDR reports I see 08003-289393 with the ‘-’ with the above it used to remove it.

The log shows

[2023-03-20 14:59:54] VERBOSE[3784][C-00000002] pbx.c: Executing [in@sub-record-check:3] ExecIf("PJSIP/anonymous-00000002", "12?Set(FROMEXTEN=08003-289393)") in new stack

You are not recognizing the trunk. You should not need to use the anonymous/guest options with PJSIP, and should turn them off as security risks. You should then check your match/permit settings, to make sure they correctly recognize the trunk.

1 Like

It looked to me the trunk wasn’t recognized. I had to ‘Allow Anonymous Inbound SIP Calls’ to enable my SPA 3102 to ring the phone. I’ve turned it off now and left on ‘Allow SIP Guests’ ̶W̶h̶e̶r̶e̶ ̶a̶r̶e̶ ̶t̶h̶e̶ ̶m̶a̶t̶c̶h̶/̶p̶e̶r̶m̶i̶t̶ ̶s̶e̶t̶t̶i̶n̶g̶s̶ ̶?̶ found it under pjsip settings :see_no_evil:

I see the warnings

[2023-03-20 16:30:19] VERBOSE[16872] netsock2.c: Using SIP RTP Audio TOS bits 184
[2023-03-20 16:30:19] VERBOSE[16872] netsock2.c: Using SIP RTP Audio TOS bits 184 in TCLASS field.
[2023-03-20 16:30:19] VERBOSE[16872] netsock2.c: Using SIP RTP Audio CoS mark 5
[2023-03-20 16:30:19] VERBOSE[17506][C-00000009] pbx.c: Executing [17070@from-internal:1] Macro("PJSIP/221-0000000e", "user-callerid,LIMIT,EXTERNAL,") in new stack
[2023-03-20 16:30:19] VERBOSE[17506][C-00000009] pbx.c: Executing [s@macro-user-callerid:1] Set("PJSIP/221-0000000e", "TOUCH_MONITOR=1679329819.14") in new stack
[2023-03-20 16:30:19] VERBOSE[17506][C-00000009] pbx.c: Executing [s@macro-user-callerid:2] Set("PJSIP/221-0000000e", "CHANCONTEXT=") in new stack
[2023-03-20 16:30:19] VERBOSE[17506][C-00000009] pbx.c: Executing [s@macro-user-callerid:3] Set("PJSIP/221-0000000e", "CHANCONTEXT=") in new stack
[2023-03-20 16:30:19] VERBOSE[17506][C-00000009] pbx.c: Executing [s@macro-user-callerid:4] Set("PJSIP/221-0000000e", "CHANEXTENCONTEXT=221-0000000e") in new stack
[2023-03-20 16:30:19] VERBOSE[17506][C-00000009] pbx.c: Executing [s@macro-user-callerid:5] Set("PJSIP/221-0000000e", "CHANEXTEN=221-0000000e") in new stack
[2023-03-20 16:30:19] VERBOSE[17506][C-00000009] pbx.c: Executing [s@macro-user-callerid:6] Set("PJSIP/221-0000000e", "CALLERID(number)=221") in new stack
[2023-03-20 16:30:19] VERBOSE[17506][C-00000009] pbx.c: Executing [s@macro-user-callerid:7] Set("PJSIP/221-0000000e", "AMPUSER=221") in new stack
[2023-03-20 16:30:19] VERBOSE[17506][C-00000009] pbx.c: Executing [s@macro-user-callerid:8] Set("PJSIP/221-0000000e", "HOTDESCKCHAN=221-0000000e") in new stack
[2023-03-20 16:30:19] VERBOSE[17506][C-00000009] pbx.c: Executing [s@macro-user-callerid:9] Set("PJSIP/221-0000000e", "HOTDESKEXTEN=221") in new stack
[2023-03-20 16:30:19] VERBOSE[17506][C-00000009] pbx.c: Executing [s@macro-user-callerid:10] Set("PJSIP/221-0000000e", "HOTDESKCALL=0") in new stack
[2023-03-20 16:30:19] VERBOSE[17506][C-00000009] pbx.c: Executing [s@macro-user-callerid:11] ExecIf("PJSIP/221-0000000e", "0?Set(HOTDESKCALL=1)") in new stack
[2023-03-20 16:30:19] VERBOSE[17506][C-00000009] pbx.c: Executing [s@macro-user-callerid:12] ExecIf("PJSIP/221-0000000e", "0?Set(CALLERID(name)=)") in new stack
[2023-03-20 16:30:19] VERBOSE[17506][C-00000009] pbx.c: Executing [s@macro-user-callerid:13] GotoIf("PJSIP/221-0000000e", "0?report") in new stack
[2023-03-20 16:30:19] VERBOSE[17506][C-00000009] pbx.c: Executing [s@macro-user-callerid:14] ExecIf("PJSIP/221-0000000e", "1?Set(REALCALLERIDNUM=221)") in new stack
[2023-03-20 16:30:19] VERBOSE[17506][C-00000009] pbx.c: Executing [s@macro-user-callerid:15] Set("PJSIP/221-0000000e", "AMPUSER=221") in new stack
[2023-03-20 16:30:19] VERBOSE[17506][C-00000009] pbx.c: Executing [s@macro-user-callerid:16] GotoIf("PJSIP/221-0000000e", "0?limit") in new stack
[2023-03-20 16:30:19] VERBOSE[17506][C-00000009] pbx.c: Executing [s@macro-user-callerid:17] Set("PJSIP/221-0000000e", "AMPUSERCIDNAME=DECT 3102") in new stack
[2023-03-20 16:30:19] VERBOSE[17506][C-00000009] pbx.c: Executing [s@macro-user-callerid:18] ExecIf("PJSIP/221-0000000e", "0?Set(__CIDMASQUERADING=TRUE)") in new stack
[2023-03-20 16:30:19] VERBOSE[17506][C-00000009] pbx.c: Executing [s@macro-user-callerid:19] GotoIf("PJSIP/221-0000000e", "0?report") in new stack
[2023-03-20 16:30:19] VERBOSE[17506][C-00000009] pbx.c: Executing [s@macro-user-callerid:20] Set("PJSIP/221-0000000e", "AMPUSERCID=221") in new stack
[2023-03-20 16:30:19] VERBOSE[17506][C-00000009] pbx.c: Executing [s@macro-user-callerid:21] Set("PJSIP/221-0000000e", "__DIAL_OPTIONS=tr") in new stack
[2023-03-20 16:30:19] VERBOSE[17506][C-00000009] pbx.c: Executing [s@macro-user-callerid:22] Set("PJSIP/221-0000000e", "CALLERID(all)="DECT 3102" <221>") in new stack
[2023-03-20 16:30:19] VERBOSE[17506][C-00000009] pbx.c: Executing [s@macro-user-callerid:23] ExecIf("PJSIP/221-0000000e", "0?Set(CUSDIAL=)") in new stack
[2023-03-20 16:30:19] VERBOSE[17506][C-00000009] pbx.c: Executing [s@macro-user-callerid:24] ExecIf("PJSIP/221-0000000e", "0?Set(CALLERID(all)="DECT 3102" <221>)") in new stack
[2023-03-20 16:30:19] VERBOSE[17506][C-00000009] pbx.c: Executing [s@macro-user-callerid:25] GotoIf("PJSIP/221-0000000e", "0?limit") in new stack
[2023-03-20 16:30:19] VERBOSE[17506][C-00000009] pbx.c: Executing [s@macro-user-callerid:26] ExecIf("PJSIP/221-0000000e", "1?Set(GROUP(concurrency_limit)=221)") in new stack
[2023-03-20 16:30:19] VERBOSE[17506][C-00000009] pbx.c: Executing [s@macro-user-callerid:27] ExecIf("PJSIP/221-0000000e", "0?Set(CHANNEL(language)=)") in new stack
[2023-03-20 16:30:19] VERBOSE[17506][C-00000009] pbx.c: Executing [s@macro-user-callerid:28] NoOp("PJSIP/221-0000000e", "Macro Depth is 1") in new stack
[2023-03-20 16:30:19] VERBOSE[17506][C-00000009] pbx.c: Executing [s@macro-user-callerid:29] GotoIf("PJSIP/221-0000000e", "1?report2:macroerror") in new stack
[2023-03-20 16:30:19] VERBOSE[17506][C-00000009] pbx_builtins.c: Goto (macro-user-callerid,s,30)
[2023-03-20 16:30:19] VERBOSE[17506][C-00000009] pbx.c: Executing [s@macro-user-callerid:30] GotoIf("PJSIP/221-0000000e", "1?continue") in new stack
[2023-03-20 16:30:19] VERBOSE[17506][C-00000009] pbx_builtins.c: Goto (macro-user-callerid,s,49)
[2023-03-20 16:30:19] VERBOSE[17506][C-00000009] pbx.c: Executing [s@macro-user-callerid:49] Set("PJSIP/221-0000000e", "CALLERID(number)=221") in new stack
[2023-03-20 16:30:19] VERBOSE[17506][C-00000009] pbx.c: Executing [s@macro-user-callerid:50] Set("PJSIP/221-0000000e", "CALLERID(name)=DECT 3102") in new stack
[2023-03-20 16:30:19] VERBOSE[17506][C-00000009] pbx.c: Executing [s@macro-user-callerid:51] GotoIf("PJSIP/221-0000000e", "0?cnum") in new stack
[2023-03-20 16:30:19] VERBOSE[17506][C-00000009] pbx.c: Executing [s@macro-user-callerid:52] Set("PJSIP/221-0000000e", "__MCNUM=221") in new stack
[2023-03-20 16:30:19] VERBOSE[17506][C-00000009] pbx.c: Executing [s@macro-user-callerid:53] Set("PJSIP/221-0000000e", "__MCNAME=DECT 3102") in new stack
[2023-03-20 16:30:19] VERBOSE[17506][C-00000009] pbx.c: Executing [s@macro-user-callerid:54] Set("PJSIP/221-0000000e", "__MCEXTEN=221") in new stack
[2023-03-20 16:30:19] VERBOSE[17506][C-00000009] pbx.c: Executing [s@macro-user-callerid:55] Set("PJSIP/221-0000000e", "__MCORGCHAN=PJSIP/221-0000000e") in new stack
[2023-03-20 16:30:19] VERBOSE[17506][C-00000009] pbx.c: Executing [s@macro-user-callerid:56] Set("PJSIP/221-0000000e", "CDR(cnam)=DECT 3102") in new stack
[2023-03-20 16:30:19] VERBOSE[17506][C-00000009] pbx.c: Executing [s@macro-user-callerid:57] Set("PJSIP/221-0000000e", "CDR(cnum)=221") in new stack
[2023-03-20 16:30:19] VERBOSE[17506][C-00000009] pbx.c: Executing [s@macro-user-callerid:58] Set("PJSIP/221-0000000e", "CHANNEL(language)=en_GB") in new stack
[2023-03-20 16:30:19] VERBOSE[17506][C-00000009] pbx.c: Executing [17070@from-internal:2] Gosub("PJSIP/221-0000000e", "sub-record-check,s,1(out,17070,dontcare)") in new stack
[2023-03-20 16:30:19] VERBOSE[17506][C-00000009] pbx.c: Executing [s@sub-record-check:1] GotoIf("PJSIP/221-0000000e", "0?initialized") in new stack
[2023-03-20 16:30:19] VERBOSE[17506][C-00000009] pbx.c: Executing [s@sub-record-check:2] Set("PJSIP/221-0000000e", "__REC_STATUS=INITIALIZED") in new stack
[2023-03-20 16:30:19] VERBOSE[17506][C-00000009] pbx.c: Executing [s@sub-record-check:3] Set("PJSIP/221-0000000e", "NOW=1679329819") in new stack
[2023-03-20 16:30:19] VERBOSE[17506][C-00000009] pbx.c: Executing [s@sub-record-check:4] Set("PJSIP/221-0000000e", "__DAY=20") in new stack
[2023-03-20 16:30:19] VERBOSE[17506][C-00000009] pbx.c: Executing [s@sub-record-check:5] Set("PJSIP/221-0000000e", "__MONTH=03") in new stack
[2023-03-20 16:30:19] VERBOSE[17506][C-00000009] pbx.c: Executing [s@sub-record-check:6] Set("PJSIP/221-0000000e", "__YEAR=2023") in new stack
[2023-03-20 16:30:19] VERBOSE[17506][C-00000009] pbx.c: Executing [s@sub-record-check:7] Set("PJSIP/221-0000000e", "__TIMESTR=20230320-163019") in new stack
[2023-03-20 16:30:19] VERBOSE[17506][C-00000009] pbx.c: Executing [s@sub-record-check:8] Set("PJSIP/221-0000000e", "__FROMEXTEN=221") in new stack
[2023-03-20 16:30:19] VERBOSE[17506][C-00000009] pbx.c: Executing [s@sub-record-check:9] Set("PJSIP/221-0000000e", "__MON_FMT=WAV") in new stack
[2023-03-20 16:30:19] VERBOSE[17506][C-00000009] pbx.c: Executing [s@sub-record-check:10] NoOp("PJSIP/221-0000000e", "Recordings initialized") in new stack
[2023-03-20 16:30:19] VERBOSE[17506][C-00000009] pbx.c: Executing [s@sub-record-check:11] ExecIf("PJSIP/221-0000000e", "0?Set(ARG3=dontcare)") in new stack
[2023-03-20 16:30:19] VERBOSE[17506][C-00000009] pbx.c: Executing [s@sub-record-check:12] Set("PJSIP/221-0000000e", "REC_POLICY_MODE_SAVE=") in new stack
[2023-03-20 16:30:19] VERBOSE[17506][C-00000009] pbx.c: Executing [s@sub-record-check:13] ExecIf("PJSIP/221-0000000e", "0?Set(REC_STATUS=NO)") in new stack
[2023-03-20 16:30:19] VERBOSE[17506][C-00000009] pbx.c: Executing [s@sub-record-check:14] GotoIf("PJSIP/221-0000000e", "3?checkaction") in new stack
[2023-03-20 16:30:19] VERBOSE[17506][C-00000009] pbx_builtins.c: Goto (sub-record-check,s,17)
[2023-03-20 16:30:19] VERBOSE[17506][C-00000009] pbx.c: Executing [s@sub-record-check:17] GotoIf("PJSIP/221-0000000e", "1?sub-record-check,out,1") in new stack
[2023-03-20 16:30:19] VERBOSE[17506][C-00000009] pbx_builtins.c: Goto (sub-record-check,out,1)
[2023-03-20 16:30:19] VERBOSE[17506][C-00000009] pbx.c: Executing [out@sub-record-check:1] NoOp("PJSIP/221-0000000e", "Outbound Recording Check from 221 to 17070") in new stack
[2023-03-20 16:30:19] VERBOSE[17506][C-00000009] pbx.c: Executing [out@sub-record-check:2] Set("PJSIP/221-0000000e", "RECMODE=yes") in new stack
[2023-03-20 16:30:19] VERBOSE[17506][C-00000009] pbx.c: Executing [out@sub-record-check:3] ExecIf("PJSIP/221-0000000e", "0?Goto(routewins)") in new stack
[2023-03-20 16:30:19] VERBOSE[17506][C-00000009] pbx.c: Executing [out@sub-record-check:4] ExecIf("PJSIP/221-0000000e", "0?Goto(routewins)") in new stack
[2023-03-20 16:30:19] VERBOSE[17506][C-00000009] pbx.c: Executing [out@sub-record-check:5] Gosub("PJSIP/221-0000000e", "recordcheck,1(yes,out,17070)") in new stack
[2023-03-20 16:30:19] VERBOSE[17506][C-00000009] pbx.c: Executing [recordcheck@sub-record-check:1] NoOp("PJSIP/221-0000000e", "Starting recording check against yes") in new stack
[2023-03-20 16:30:19] VERBOSE[17506][C-00000009] pbx.c: Executing [recordcheck@sub-record-check:2] Goto("PJSIP/221-0000000e", "yes") in new stack
[2023-03-20 16:30:19] VERBOSE[17506][C-00000009] pbx_builtins.c: Goto (sub-record-check,recordcheck,9)
[2023-03-20 16:30:19] VERBOSE[17506][C-00000009] pbx.c: Executing [recordcheck@sub-record-check:9] ExecIf("PJSIP/221-0000000e", "0?Return()") in new stack
[2023-03-20 16:30:19] VERBOSE[17506][C-00000009] pbx.c: Executing [recordcheck@sub-record-check:10] Set("PJSIP/221-0000000e", "__REC_POLICY_MODE=YES") in new stack
[2023-03-20 16:30:19] VERBOSE[17506][C-00000009] pbx.c: Executing [recordcheck@sub-record-check:11] Goto("PJSIP/221-0000000e", "startrec") in new stack
[2023-03-20 16:30:19] VERBOSE[17506][C-00000009] pbx_builtins.c: Goto (sub-record-check,recordcheck,16)
[2023-03-20 16:30:19] VERBOSE[17506][C-00000009] pbx.c: Executing [recordcheck@sub-record-check:16] NoOp("PJSIP/221-0000000e", "Starting recording: out, 17070") in new stack
[2023-03-20 16:30:19] VERBOSE[17506][C-00000009] pbx.c: Executing [recordcheck@sub-record-check:17] Set("PJSIP/221-0000000e", "__CALLFILENAME=out-17070-221-20230320-163019-1679329819.14") in new stack
[2023-03-20 16:30:19] VERBOSE[17506][C-00000009] pbx.c: Executing [recordcheck@sub-record-check:18] MixMonitor("PJSIP/221-0000000e", "2023/03/20/out-17070-221-20230320-163019-1679329819.14.WAV,abi(),") in new stack
[2023-03-20 16:30:19] VERBOSE[17506][C-00000009] pbx.c: Executing [recordcheck@sub-record-check:19] Set("PJSIP/221-0000000e", "__MIXMON_ID=") in new stack
[2023-03-20 16:30:19] VERBOSE[17506][C-00000009] pbx.c: Executing [recordcheck@sub-record-check:20] Set("PJSIP/221-0000000e", "__RECORD_ID=PJSIP/221-0000000e") in new stack
[2023-03-20 16:30:19] VERBOSE[17506][C-00000009] pbx.c: Executing [recordcheck@sub-record-check:21] Set("PJSIP/221-0000000e", "__REC_STATUS=RECORDING") in new stack
[2023-03-20 16:30:19] VERBOSE[17506][C-00000009] pbx.c: Executing [recordcheck@sub-record-check:22] Set("PJSIP/221-0000000e", "CDR(recordingfile)=out-17070-221-20230320-163019-1679329819.14.WAV") in new stack
[2023-03-20 16:30:19] VERBOSE[17506][C-00000009] pbx.c: Executing [recordcheck@sub-record-check:23] Return("PJSIP/221-0000000e", "") in new stack
[2023-03-20 16:30:19] VERBOSE[17506][C-00000009] pbx.c: Executing [out@sub-record-check:6] Return("PJSIP/221-0000000e", "") in new stack
[2023-03-20 16:30:19] VERBOSE[17506][C-00000009] pbx.c: Executing [17070@from-internal:3] ExecIf("PJSIP/221-0000000e", "0 ?Set(CDR(accountcode)=)") in new stack
[2023-03-20 16:30:19] VERBOSE[17506][C-00000009] pbx.c: Executing [17070@from-internal:4] Set("PJSIP/221-0000000e", "_ROUTEID=5") in new stack
[2023-03-20 16:30:19] VERBOSE[17506][C-00000009] pbx.c: Executing [17070@from-internal:5] Set("PJSIP/221-0000000e", "_ROUTENAME=BT-LandLine") in new stack
[2023-03-20 16:30:19] VERBOSE[17506][C-00000009] pbx.c: Executing [17070@from-internal:6] Set("PJSIP/221-0000000e", "EMERGENCYROUTE=YES") in new stack
[2023-03-20 16:30:19] VERBOSE[17506][C-00000009] pbx.c: Executing [17070@from-internal:7] Set("PJSIP/221-0000000e", "MOHCLASS=default") in new stack
[2023-03-20 16:30:19] VERBOSE[17506][C-00000009] pbx.c: Executing [17070@from-internal:8] Set("PJSIP/221-0000000e", "_CALLERIDNAMEINTERNAL=DECT 3102") in new stack
[2023-03-20 16:30:19] VERBOSE[17506][C-00000009] pbx.c: Executing [17070@from-internal:9] Set("PJSIP/221-0000000e", "_CALLERIDNUMINTERNAL=221") in new stack
[2023-03-20 16:30:19] VERBOSE[17506][C-00000009] pbx.c: Executing [17070@from-internal:10] Set("PJSIP/221-0000000e", "_EMAILNOTIFICATION=FALSE") in new stack
[2023-03-20 16:30:19] VERBOSE[17506][C-00000009] pbx.c: Executing [17070@from-internal:11] Set("PJSIP/221-0000000e", "_NODEST=") in new stack
[2023-03-20 16:30:19] VERBOSE[17506][C-00000009] pbx.c: Executing [17070@from-internal:12] Macro("PJSIP/221-0000000e", "dialout-trunk,6,17070,,off") in new stack
[2023-03-20 16:30:19] VERBOSE[17506][C-00000009] pbx.c: Executing [s@macro-dialout-trunk:1] Set("PJSIP/221-0000000e", "DIAL_TRUNK=6") in new stack
[2023-03-20 16:30:19] VERBOSE[17506][C-00000009] pbx.c: Executing [s@macro-dialout-trunk:2] ExecIf("PJSIP/221-0000000e", "0?Set(DIAL_OPTIONS=tr)") in new stack
[2023-03-20 16:30:19] VERBOSE[17506][C-00000009] pbx.c: Executing [s@macro-dialout-trunk:3] GosubIf("PJSIP/221-0000000e", "0?sub-pincheck,s,1()") in new stack
[2023-03-20 16:30:19] VERBOSE[17506][C-00000009] pbx.c: Executing [s@macro-dialout-trunk:4] ExecIf("PJSIP/221-0000000e", "0?Set(CALLERID(num)=221)") in new stack
[2023-03-20 16:30:19] VERBOSE[17506][C-00000009] pbx.c: Executing [s@macro-dialout-trunk:5] GotoIf("PJSIP/221-0000000e", "0?disabletrunk,1") in new stack
[2023-03-20 16:30:19] VERBOSE[17506][C-00000009] pbx.c: Executing [s@macro-dialout-trunk:6] Set("PJSIP/221-0000000e", "DIAL_NUMBER=17070") in new stack
[2023-03-20 16:30:19] VERBOSE[17506][C-00000009] pbx.c: Executing [s@macro-dialout-trunk:7] Set("PJSIP/221-0000000e", "DIAL_TRUNK_OPTIONS=tr") in new stack
[2023-03-20 16:30:19] VERBOSE[17506][C-00000009] pbx.c: Executing [s@macro-dialout-trunk:8] Set("PJSIP/221-0000000e", "OUTBOUND_GROUP=OUT_6") in new stack
[2023-03-20 16:30:19] VERBOSE[17506][C-00000009] pbx.c: Executing [s@macro-dialout-trunk:9] Set("PJSIP/221-0000000e", "DIAL_TRUNK_OPTIONS=") in new stack
[2023-03-20 16:30:19] VERBOSE[17506][C-00000009] pbx.c: Executing [s@macro-dialout-trunk:10] GotoIf("PJSIP/221-0000000e", "0?nomax") in new stack
[2023-03-20 16:30:19] VERBOSE[17506][C-00000009] pbx.c: Executing [s@macro-dialout-trunk:11] GotoIf("PJSIP/221-0000000e", "0?chanfull") in new stack
[2023-03-20 16:30:19] VERBOSE[17506][C-00000009] pbx.c: Executing [s@macro-dialout-trunk:12] GotoIf("PJSIP/221-0000000e", "0?skipoutcid") in new stack
[2023-03-20 16:30:19] VERBOSE[17506][C-00000009] pbx.c: Executing [s@macro-dialout-trunk:13] Macro("PJSIP/221-0000000e", "outbound-callerid,6") in new stack
[2023-03-20 16:30:19] VERBOSE[17506][C-00000009] pbx.c: Executing [s@macro-outbound-callerid:1] NoOp("PJSIP/221-0000000e", "221") in new stack
[2023-03-20 16:30:19] VERBOSE[17506][C-00000009] pbx.c: Executing [s@macro-outbound-callerid:2] NoOp("PJSIP/221-0000000e", "") in new stack
[2023-03-20 16:30:19] VERBOSE[17506][C-00000009] pbx.c: Executing [s@macro-outbound-callerid:3] NoOp("PJSIP/221-0000000e", "off") in new stack
[2023-03-20 16:30:19] VERBOSE[17506][C-00000009] pbx.c: Executing [s@macro-outbound-callerid:4] ExecIf("PJSIP/221-0000000e", "0?Set(CALLERID(name-pres)=)") in new stack
[2023-03-20 16:30:19] VERBOSE[17506][C-00000009] pbx.c: Executing [s@macro-outbound-callerid:5] ExecIf("PJSIP/221-0000000e", "0?Set(CALLERID(num-pres)=)") in new stack
[2023-03-20 16:30:19] VERBOSE[17506][C-00000009] pbx.c: Executing [s@macro-outbound-callerid:6] Set("PJSIP/221-0000000e", "HOTDESCKCHAN=221-0000000e") in new stack
[2023-03-20 16:30:19] VERBOSE[17506][C-00000009] pbx.c: Executing [s@macro-outbound-callerid:7] Set("PJSIP/221-0000000e", "HOTDESKEXTEN=221") in new stack
[2023-03-20 16:30:19] VERBOSE[17506][C-00000009] pbx.c: Executing [s@macro-outbound-callerid:8] Set("PJSIP/221-0000000e", "HOTDESKCALL=0") in new stack
[2023-03-20 16:30:19] VERBOSE[17506][C-00000009] pbx.c: Executing [s@macro-outbound-callerid:9] ExecIf("PJSIP/221-0000000e", "0?Set(HOTDESKCALL=1)") in new stack
[2023-03-20 16:30:19] VERBOSE[17506][C-00000009] pbx.c: Executing [s@macro-outbound-callerid:10] ExecIf("PJSIP/221-0000000e", "0?Set(CALLERID(name)=)") in new stack
[2023-03-20 16:30:19] VERBOSE[17506][C-00000009] pbx.c: Executing [s@macro-outbound-callerid:11] Set("PJSIP/221-0000000e", "ALLOWTHISROUTE=NO") in new stack
[2023-03-20 16:30:19] VERBOSE[17506][C-00000009] pbx.c: Executing [s@macro-outbound-callerid:12] ExecIf("PJSIP/221-0000000e", "1?Set(ALLOWTHISROUTE=YES)") in new stack
[2023-03-20 16:30:19] VERBOSE[17506][C-00000009] pbx.c: Executing [s@macro-outbound-callerid:13] ExecIf("PJSIP/221-0000000e", "0?Hangup()") in new stack
[2023-03-20 16:30:19] VERBOSE[17506][C-00000009] pbx.c: Executing [s@macro-outbound-callerid:14] ExecIf("PJSIP/221-0000000e", "0?Set(REALCALLERIDNUM=221)") in new stack
[2023-03-20 16:30:19] VERBOSE[17506][C-00000009] pbx.c: Executing [s@macro-outbound-callerid:15] ExecIf("PJSIP/221-0000000e", "0?Set(AMPUSER=221)") in new stack
[2023-03-20 16:30:19] VERBOSE[17506][C-00000009] pbx.c: Executing [s@macro-outbound-callerid:16] GotoIf("PJSIP/221-0000000e", "1?normcid") in new stack
[2023-03-20 16:30:19] VERBOSE[17506][C-00000009] pbx_builtins.c: Goto (macro-outbound-callerid,s,20)
[2023-03-20 16:30:19] VERBOSE[17506][C-00000009] pbx.c: Executing [s@macro-outbound-callerid:20] Set("PJSIP/221-0000000e", "USEROUTCID=") in new stack
[2023-03-20 16:30:19] VERBOSE[17506][C-00000009] pbx.c: Executing [s@macro-outbound-callerid:21] Set("PJSIP/221-0000000e", "EMERGENCYCID=") in new stack
[2023-03-20 16:30:19] VERBOSE[17506][C-00000009] pbx.c: Executing [s@macro-outbound-callerid:22] ExecIf("PJSIP/221-0000000e", "0?Set(EMERGENCYCID=)") in new stack
[2023-03-20 16:30:19] VERBOSE[17506][C-00000009] pbx.c: Executing [s@macro-outbound-callerid:23] Set("PJSIP/221-0000000e", "TRUNKOUTCID=01234567891545") in new stack
[2023-03-20 16:30:19] VERBOSE[17506][C-00000009] pbx.c: Executing [s@macro-outbound-callerid:24] GotoIf("PJSIP/221-0000000e", "1?trunkcid") in new stack
[2023-03-20 16:30:19] VERBOSE[17506][C-00000009] pbx_builtins.c: Goto (macro-outbound-callerid,s,30)
[2023-03-20 16:30:19] VERBOSE[17506][C-00000009] pbx.c: Executing [s@macro-outbound-callerid:30] ExecIf("PJSIP/221-0000000e", "1?Set(CALLERID(all)=01234567891545)") in new stack
[2023-03-20 16:30:19] VERBOSE[17506][C-00000009] pbx.c: Executing [s@macro-outbound-callerid:31] ExecIf("PJSIP/221-0000000e", "0?Set(CALLERID(all)=)") in new stack
[2023-03-20 16:30:19] VERBOSE[17506][C-00000009] pbx.c: Executing [s@macro-outbound-callerid:32] ExecIf("PJSIP/221-0000000e", "0?Set(CALLERID(all)=)") in new stack
[2023-03-20 16:30:19] VERBOSE[17506][C-00000009] pbx.c: Executing [s@macro-outbound-callerid:33] ExecIf("PJSIP/221-0000000e", "0?Set(CALLERID(all)=221)") in new stack
[2023-03-20 16:30:19] VERBOSE[17506][C-00000009] pbx.c: Executing [s@macro-outbound-callerid:34] ExecIf("PJSIP/221-0000000e", "0?Set(CALLERID(all)=221)") in new stack
[2023-03-20 16:30:19] VERBOSE[17506][C-00000009] pbx.c: Executing [s@macro-outbound-callerid:35] Set("PJSIP/221-0000000e", "TIOHIDE=no") in new stack
[2023-03-20 16:30:19] VERBOSE[17506][C-00000009] pbx.c: Executing [s@macro-outbound-callerid:36] ExecIf("PJSIP/221-0000000e", "0?Set(CALLERID(name-pres)=prohib_passed_screen)") in new stack
[2023-03-20 16:30:19] VERBOSE[17506][C-00000009] pbx.c: Executing [s@macro-outbound-callerid:37] ExecIf("PJSIP/221-0000000e", "0?Set(CALLERID(num-pres)=prohib_passed_screen)") in new stack
[2023-03-20 16:30:19] VERBOSE[17506][C-00000009] pbx.c: Executing [s@macro-outbound-callerid:38] ExecIf("PJSIP/221-0000000e", "0?Set(CALLERID(name-pres)=prohib_passed_screen)") in new stack
[2023-03-20 16:30:19] VERBOSE[17506][C-00000009] pbx.c: Executing [s@macro-outbound-callerid:39] ExecIf("PJSIP/221-0000000e", "0?Set(CALLERID(num-pres)=prohib_passed_screen)") in new stack
[2023-03-20 16:30:19] VERBOSE[17506][C-00000009] pbx.c: Executing [s@macro-outbound-callerid:40] Set("PJSIP/221-0000000e", "CDR(outbound_cnum)=01234567891545") in new stack
[2023-03-20 16:30:19] VERBOSE[17506][C-00000009] pbx.c: Executing [s@macro-outbound-callerid:41] Set("PJSIP/221-0000000e", "CDR(outbound_cnam)=") in new stack
[2023-03-20 16:30:19] VERBOSE[17506][C-00000009] pbx.c: Executing [s@macro-dialout-trunk:14] GosubIf("PJSIP/221-0000000e", "0?sub-flp-6,s,1()") in new stack
[2023-03-20 16:30:19] VERBOSE[17506][C-00000009] pbx.c: Executing [s@macro-dialout-trunk:15] Set("PJSIP/221-0000000e", "OUTNUM=17070") in new stack
[2023-03-20 16:30:19] VERBOSE[17506][C-00000009] pbx.c: Executing [s@macro-dialout-trunk:16] Set("PJSIP/221-0000000e", "custom=PJSIP") in new stack
[2023-03-20 16:30:19] VERBOSE[17506][C-00000009] pbx.c: Executing [s@macro-dialout-trunk:17] ExecIf("PJSIP/221-0000000e", "0?Set(DIAL_TRUNK_OPTIONS=M(setmusic^default))") in new stack
[2023-03-20 16:30:19] VERBOSE[17506][C-00000009] pbx.c: Executing [s@macro-dialout-trunk:18] ExecIf("PJSIP/221-0000000e", "0?Set(DIAL_TRUNK_OPTIONS=M(confirm))") in new stack
[2023-03-20 16:30:19] VERBOSE[17506][C-00000009] pbx.c: Executing [s@macro-dialout-trunk:19] GotoIf("PJSIP/221-0000000e", "1?gocall") in new stack
[2023-03-20 16:30:19] VERBOSE[17506][C-00000009] pbx_builtins.c: Goto (macro-dialout-trunk,s,21)
[2023-03-20 16:30:19] VERBOSE[17506][C-00000009] pbx.c: Executing [s@macro-dialout-trunk:21] Macro("PJSIP/221-0000000e", "dialout-trunk-predial-hook,") in new stack
[2023-03-20 16:30:19] VERBOSE[17506][C-00000009] pbx.c: Executing [s@macro-dialout-trunk-predial-hook:1] MacroExit("PJSIP/221-0000000e", "") in new stack
[2023-03-20 16:30:19] VERBOSE[17506][C-00000009] pbx.c: Executing [s@macro-dialout-trunk:22] GotoIf("PJSIP/221-0000000e", "0?bypass,1") in new stack
[2023-03-20 16:30:19] VERBOSE[17506][C-00000009] pbx.c: Executing [s@macro-dialout-trunk:23] ExecIf("PJSIP/221-0000000e", "1?Set(CONNECTEDLINE(num,i)=17070)") in new stack
[2023-03-20 16:30:19] VERBOSE[17506][C-00000009] pbx.c: Executing [s@macro-dialout-trunk:24] ExecIf("PJSIP/221-0000000e", "1?Set(CONNECTEDLINE(name,i)=CID:01234567891545)") in new stack
[2023-03-20 16:30:19] VERBOSE[17506][C-00000009] pbx.c: Executing [s@macro-dialout-trunk:25] ExecIf("PJSIP/221-0000000e", "0?Set(CONNECTEDLINE(name,i)=CID:(Hidden)01234567891545)") in new stack
[2023-03-20 16:30:19] VERBOSE[17506][C-00000009] pbx.c: Executing [s@macro-dialout-trunk:26] GotoIf("PJSIP/221-0000000e", "0?customtrunk") in new stack
[2023-03-20 16:30:19] VERBOSE[17506][C-00000009] pbx.c: Executing [s@macro-dialout-trunk:27] ExecIf("PJSIP/221-0000000e", "0?Set(DIAL_TRUNK_OPTIONS=)") in new stack
[2023-03-20 16:30:19] VERBOSE[17506][C-00000009] pbx.c: Executing [s@macro-dialout-trunk:28] Set("PJSIP/221-0000000e", "HASH(__SIPHEADERS,Alert-Info)=unset") in new stack
[2023-03-20 16:30:19] VERBOSE[17506][C-00000009] pbx.c: Executing [s@macro-dialout-trunk:29] Dial("PJSIP/221-0000000e", "PJSIP/17070@LLBT2,300,b(func-apply-sipheaders^s^1,(6))U(sub-send-obroute-email^17070^17070^6^1679329819^^01234567891545)") in new stack
[2023-03-20 16:30:19] VERBOSE[17508][C-00000009] app_mixmonitor.c: Begin MixMonitor Recording PJSIP/221-0000000e
[2023-03-20 16:30:19] VERBOSE[17506][C-00000009] app_stack.c: PJSIP/LLBT2-0000000f Internal Gosub(func-apply-sipheaders,s,1(6)) start
[2023-03-20 16:30:19] VERBOSE[17506][C-00000009] pbx.c: Executing [s@func-apply-sipheaders:1] NoOp("PJSIP/LLBT2-0000000f", "Applying SIP Headers to channel PJSIP/LLBT2-0000000f") in new stack
[2023-03-20 16:30:19] VERBOSE[17506][C-00000009] pbx.c: Executing [s@func-apply-sipheaders:2] Set("PJSIP/LLBT2-0000000f", "CHANNEL(hangup_handler_push)=app-missedcall-hangup,,1") in new stack
[2023-03-20 16:30:19] VERBOSE[17506][C-00000009] pbx.c: Executing [s@func-apply-sipheaders:3] Set("PJSIP/LLBT2-0000000f", "TECH=PJSIP") in new stack
[2023-03-20 16:30:19] VERBOSE[17506][C-00000009] pbx.c: Executing [s@func-apply-sipheaders:4] Set("PJSIP/LLBT2-0000000f", "SIPHEADERKEYS=Alert-Info") in new stack
[2023-03-20 16:30:19] VERBOSE[17506][C-00000009] pbx.c: Executing [s@func-apply-sipheaders:5] While("PJSIP/LLBT2-0000000f", "1") in new stack
[2023-03-20 16:30:19] VERBOSE[17506][C-00000009] pbx.c: Executing [s@func-apply-sipheaders:6] Set("PJSIP/LLBT2-0000000f", "sipheader=unset") in new stack
[2023-03-20 16:30:19] VERBOSE[17506][C-00000009] pbx.c: Executing [s@func-apply-sipheaders:7] ExecIf("PJSIP/LLBT2-0000000f", "0?SIPRemoveHeader(Alert-Info:)") in new stack
[2023-03-20 16:30:19] VERBOSE[17506][C-00000009] pbx.c: Executing [s@func-apply-sipheaders:8] ExecIf("PJSIP/LLBT2-0000000f", "1?Set(PJSIP_HEADER(remove,Alert-Info)=)") in new stack
[2023-03-20 16:30:19] ERROR[16872] res_pjsip_header_funcs.c: No headers had been previously added to this session.
[2023-03-20 16:30:19] VERBOSE[17506][C-00000009] pbx.c: Executing [s@func-apply-sipheaders:9] ExecIf("PJSIP/LLBT2-0000000f", "0?Set(sipheader=<http://127.0.0.1>;info=unset)") in new stack
[2023-03-20 16:30:19] VERBOSE[17506][C-00000009] pbx.c: Executing [s@func-apply-sipheaders:10] ExecIf("PJSIP/LLBT2-0000000f", "0?Set(sipheader=<http://127.0.0.1>unset)") in new stack
[2023-03-20 16:30:19] VERBOSE[17506][C-00000009] pbx.c: Executing [s@func-apply-sipheaders:11] ExecIf("PJSIP/LLBT2-0000000f", "0?SIPAddHeader(Alert-Info:unset)") in new stack
[2023-03-20 16:30:19] VERBOSE[17506][C-00000009] pbx.c: Executing [s@func-apply-sipheaders:12] ExecIf("PJSIP/LLBT2-0000000f", "0?Set(PJSIP_HEADER(add,Alert-Info)=unset)") in new stack
[2023-03-20 16:30:19] VERBOSE[17506][C-00000009] pbx.c: Executing [s@func-apply-sipheaders:13] EndWhile("PJSIP/LLBT2-0000000f", "") in new stack
[2023-03-20 16:30:19] VERBOSE[17506][C-00000009] pbx.c: Executing [s@func-apply-sipheaders:5] While("PJSIP/LLBT2-0000000f", "0") in new stack
[2023-03-20 16:30:19] VERBOSE[17506][C-00000009] pbx.c: Executing [s@func-apply-sipheaders:14] Return("PJSIP/LLBT2-0000000f", "") in new stack
[2023-03-20 16:30:19] VERBOSE[17506][C-00000009] app_stack.c: Spawn extension (func-apply-sipheaders, s, 14) exited non-zero on 'PJSIP/LLBT2-0000000f'
[2023-03-20 16:30:19] VERBOSE[17506][C-00000009] app_stack.c: PJSIP/LLBT2-0000000f Internal Gosub(func-apply-sipheaders,s,1(6)) complete GOSUB_RETVAL=
[2023-03-20 16:30:19] VERBOSE[17506][C-00000009] app_dial.c: Called PJSIP/17070@LLBT2
[2023-03-20 16:30:19] VERBOSE[17506][C-00000009] app_dial.c: PJSIP/LLBT2-0000000f answered PJSIP/221-0000000e
[2023-03-20 16:30:19] VERBOSE[17506][C-00000009] app_stack.c: PJSIP/LLBT2-0000000f Internal Gosub(sub-send-obroute-email,s,1(17070,17070,6,1679329819,,01234567891545)) start
[2023-03-20 16:30:19] VERBOSE[17506][C-00000009] pbx.c: Executing [s@sub-send-obroute-email:1] GotoIf("PJSIP/LLBT2-0000000f", "0?sendEmail") in new stack
[2023-03-20 16:30:19] VERBOSE[17506][C-00000009] pbx.c: Executing [s@sub-send-obroute-email:2] NoOp("PJSIP/LLBT2-0000000f", "email notifications disabled..exiting.") in new stack
[2023-03-20 16:30:19] VERBOSE[17506][C-00000009] pbx.c: Executing [s@sub-send-obroute-email:3] Return("PJSIP/LLBT2-0000000f", "") in new stack
[2023-03-20 16:30:19] VERBOSE[17506][C-00000009] app_stack.c: Spawn extension (sub-send-obroute-email, s, 3) exited non-zero on 'PJSIP/LLBT2-0000000f'
[2023-03-20 16:30:19] VERBOSE[17506][C-00000009] app_stack.c: PJSIP/LLBT2-0000000f Internal Gosub(sub-send-obroute-email,s,1(17070,17070,6,1679329819,,01234567891545)) complete GOSUB_RETVAL=
[2023-03-20 16:30:19] VERBOSE[17510][C-00000009] bridge_channel.c: Channel PJSIP/LLBT2-0000000f joined 'simple_bridge' basic-bridge <3850a014-3ee7-4ef8-a5fb-5e71577b2194>
[2023-03-20 16:30:19] VERBOSE[17506][C-00000009] bridge_channel.c: Channel PJSIP/221-0000000e joined 'simple_bridge' basic-bridge <3850a014-3ee7-4ef8-a5fb-5e71577b2194>
[2023-03-20 16:30:29] VERBOSE[17506][C-00000009] bridge_channel.c: Channel PJSIP/221-0000000e left 'simple_bridge' basic-bridge <3850a014-3ee7-4ef8-a5fb-5e71577b2194>
[2023-03-20 16:30:29] VERBOSE[17506][C-00000009] app_macro.c: Spawn extension (macro-dialout-trunk, s, 29) exited non-zero on 'PJSIP/221-0000000e' in macro 'dialout-trunk'
[2023-03-20 16:30:29] VERBOSE[17506][C-00000009] pbx.c: Spawn extension (from-internal, 17070, 12) exited non-zero on 'PJSIP/221-0000000e'
[2023-03-20 16:30:29] VERBOSE[17506][C-00000009] pbx.c: Executing [h@from-internal:1] Macro("PJSIP/221-0000000e", "hangupcall") in new stack
[2023-03-20 16:30:29] VERBOSE[17506][C-00000009] pbx.c: Executing [s@macro-hangupcall:1] Gosub("PJSIP/221-0000000e", "app-missedcall-hangup,s,1()") in new stack
[2023-03-20 16:30:29] VERBOSE[17506][C-00000009] pbx.c: Executing [s@app-missedcall-hangup:1] NoOp("PJSIP/221-0000000e", "Callee: s") in new stack
[2023-03-20 16:30:29] VERBOSE[17506][C-00000009] pbx.c: Executing [s@app-missedcall-hangup:2] NoOp("PJSIP/221-0000000e", "Caller: 221") in new stack
[2023-03-20 16:30:29] VERBOSE[17506][C-00000009] pbx.c: Executing [s@app-missedcall-hangup:3] AGI("PJSIP/221-0000000e", "agi://127.0.0.1/missedcallnotify.php,,,s,0,,PJSIP/221-0000000e,ANSWER,") in new stack
[2023-03-20 16:30:29] VERBOSE[17510][C-00000009] bridge_channel.c: Channel PJSIP/LLBT2-0000000f left 'simple_bridge' basic-bridge <3850a014-3ee7-4ef8-a5fb-5e71577b2194>
[2023-03-20 16:30:29] VERBOSE[17510][C-00000009] app_stack.c: PJSIP/LLBT2-0000000f Internal Gosub(app-missedcall-hangup,s,1) start
[2023-03-20 16:30:29] VERBOSE[17510][C-00000009] pbx.c: Executing [s@app-missedcall-hangup:1] NoOp("PJSIP/LLBT2-0000000f", "Callee: s") in new stack
[2023-03-20 16:30:29] VERBOSE[17510][C-00000009] pbx.c: Executing [s@app-missedcall-hangup:2] NoOp("PJSIP/LLBT2-0000000f", "Caller: 221") in new stack
[2023-03-20 16:30:29] VERBOSE[17510][C-00000009] pbx.c: Executing [s@app-missedcall-hangup:3] AGI("PJSIP/LLBT2-0000000f", "agi://127.0.0.1/missedcallnotify.php,,,s,0,,PJSIP/LLBT2-0000000f,,") in new stack


I’ve added the SPA ip to permit/match, put no inbound calls

2023-03-20 17_46_06-FreePBX Administration

Try
Authentication: Both
Match Inbound Authentication: Auth ID
Match (Permit): (leave blank)

1 Like

Thanks @Stewart1 that seemed to fix the login issue and I’ve turned off Allow Anonymous Inbound SIP Calls and Allow SIP Guests both set to NO.

Also the CDR shows the number with the ‘-’ removed and now the Asterisk Phone book etc works correctly. Therefore, the CID mod must be working.

Thanks all that helped out .

Now on to ‘Lenny’ and get that going

I’ve recently posted about a custom context to remove an added ‘*-’ with my BT/Openreach landline that appears to work on that trunk from an SPA 3102.
That context is

[from-trunk-LLBT2]
exten => _X!,1,set(CALLERID(number)=${REPLACE(CALLERID(number), ,)})
exten => _X!,n,set(CALLERID(number)=${REPLACE(CALLERID(number),-,)})
exten => _X!,n,Set(CALLERID(number)=${IF($[ ${CALLERID(number)} = LLBT2]?00000:${CALLERID(number)})})
exten => _X!,n,noop(CALLERID is now ${CALLERID(all)})
exten => _X!,n,Goto(from-trunk,${EXTEN},1)

However, I’ve noticed a Sipgate truck has the same issue with the added ‘-’ after the area code. Can I just add the same context as about for that trunk to remove the extra ‘-’ ?

The LLBT2 has in its pjsip config Context from-trunk-LLBT2 and Sipgate has context=from-trunk in its SIP config. So, can I just add another custom context thus

[from-trunk]
exten => _X!,1,set(CALLERID(number)=${REPLACE(CALLERID(number), ,)})
exten => _X!,n,set(CALLERID(number)=${REPLACE(CALLERID(number),-,)})
exten => _X!,n,Set(CALLERID(number)=${IF($[ ${CALLERID(number)} = LLBT2]?00000:${CALLERID(number)})})
exten => _X!,n,noop(CALLERID is now ${CALLERID(all)})
exten => _X!,n,Goto(from-trunk,${EXTEN},1) 

Under the existing LLBT2 one for Sipgate trunk ?

If the main issue here is removing non-numeric characters from strings, there’s a handy dialplan function for that, FILTER. See this post:

You can use the same context for as many trunks as you want.

1 Like

But that should not be from-pstn, as that is owned by FreePBX.

Ok, So I place the

exten => _.,n,Set(CALLERID(number)=${FILTER(0123456789,${CALLERID(number)})})

in the gap in the config below and that’ll remove any character other than 0-9

my extensions_custom.conf file

[from-trunk-LLBT2]
exten => _X!,1,set(CALLERID(number)=${REPLACE(CALLERID(number), ,)})
exten => _X!,n,set(CALLERID(number)=${REPLACE(CALLERID(number),-,)})
exten => _X!,n,Set(CALLERID(number)=${IF($[ ${CALLERID(number)} = LLBT2]?00000:${CALLERID(number)})})
exten => _X!,n,noop(CALLERID is now ${CALLERID(all)})
exten => _X!,n,Goto(from-trunk,${EXTEN},1)



[custom-get-did-from-sip]
exten => s,1,Noop(Fixing DID using information from SIP TO header)
exten => s,n,Set(pseudodid=${SIP_HEADER(To)})
exten => s,n,Set(pseudodid=${CUT(pseudodid,@,1)})
exten => s,n,Set(pseudodid=${CUT(pseudodid,:,2)})
exten => s,n,Set(pseudodid=${CUT(pseudodid,+,2)})
exten => s,n,Set(isuk=${REGEX("^44.*" ${pseudodid})})
exten => s,n,Set(pseudodid=${IF(${isuk}?0${pseudodid:2}:${pseudodid})})
exten => s,n,Set(pseudocid=${CALLERID(num)})
exten => s,n,Set(pseudocid=${CUT(pseudocid,+,2)})
exten => s,n,Set(isuk=${REGEX("^44.*" ${pseudocid})})
exten => s,n,Set(pseudocid=${IF(${isuk}?0${pseudocid:2}:${pseudocid})})

exten => _.,n,Set(CALLERID(number)=${FILTER(0123456789,${CALLERID(number)})})

exten => s,n,Set(CALLERID(num)=${pseudocid})
exten => s,n,Set(CALLERID(name)=${pseudocid})
exten => s,n,Goto(from-trunk,${pseudodid},1)




[Lenny]
exten => talk,1,Set(i=${IF($["0${i}"="016"]?7:$[0${i}+1])})
same => n,ExecIf($[${i}=1]?MixMonitor(${UNIQUEID}.wav))
same => n,Playback(Lenny/Lenny${i})
same => n,BackgroundDetect(Lenny/backgroundnoise,1500)

Thus, ?

Although it will work, it would be cleaner to use s, rather than “_.”, especially taking the next point into consideration.

I would argue that it would be cleaner to use the Asterisk pattern matching than explicit regex compares, so I would suggest, as soon as you have the initial pseudodid, you GoTo it, in the current context, then do the 44 prefix handling using dialplan pattern matches. Others may disagree.

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