Swap CALLERID(name) with CALLERID(number)

Hello,
I have a FreePBX server configured and running.
I have a problem when receiving Inbound Calls.
On the CALLERID(name) I receive the number instead of the name and on the CALLERID(number) i receive the name

-- Executing [s@macro-user-callerid:30] Set("SIP/OUT-00000053", "CALLERID(number)=test") in new stack
-- Executing [s@macro-user-callerid:31] Set("SIP/OUT-00000053", "CALLERID(name)=06970xxxxx") in new stack
-- Executing [s@macro-user-callerid:32] Set("SIP/OUT-00000053", "CDR(cnum)=test") in new stack
-- Executing [s@macro-user-callerid:33] Set("SIP/OUT-00000053", "CDR(cnam)=06970xxxxx") in new stack

How could I swap this configuration ?

Thanks
Mikeli

That’s new.

What inbound context are you using to answer the incoming call?

If you can post the couple of seconds of logs before this snippet, we might be able to find it in there.

Hello,
I am using context “from-trunk”
== Using SIP RTP TOS bits 184
== Using SIP RTP CoS mark 5
– Executing [453xxxxx@from-trunk:1] NoOp(“SIP/OUT-00000053”, “Catch-All DID Match - Found 453xxxxx - You probably want a DID for this.”) in new stack
– Executing [453xxxxx@from-trunk:2] Log(“SIP/OUT-00000053”, “WARNING,Friendly Scanner from 46.x.x.x”) in new stack
[2018-10-26 15:08:37] WARNING[22910][C-00000038]: Ext. 453xxxxx:2 @ from-trunk: Friendly Scanner from 46.x.x.x
– Executing [453xxxxx@from-trunk:3] Set(“SIP/OUT-00000053”, “__FROM_DID=453xxxxx”) in new stack
– Executing [453xxxxx@from-trunk:4] Goto(“SIP/OUT-00000053”, “ext-did,s,1”) in new stack
– Goto (ext-did,s,1)
– Executing [s@ext-did:1] Set(“SIP/OUT-00000053”, “__DIRECTION=INBOUND”) in new stack
– Executing [s@ext-did:2] Gosub(“SIP/OUT-00000053”, “sub-record-check,s,1(in,s,dontcare)”) in new stack
– Executing [s@sub-record-check:1] GotoIf(“SIP/OUT-00000053”, “0?initialized”) in new stack
– Executing [s@sub-record-check:2] Set(“SIP/OUT-00000053”, “__REC_STATUS=INITIALIZED”) in new stack
– Executing [s@sub-record-check:3] Set(“SIP/OUT-00000053”, “NOW=1540559317”) in new stack
– Executing [s@sub-record-check:4] Set(“SIP/OUT-00000053”, “__DAY=26”) in new stack
– Executing [s@sub-record-check:5] Set(“SIP/OUT-00000053”, “__MONTH=10”) in new stack
– Executing [s@sub-record-check:6] Set(“SIP/OUT-00000053”, “__YEAR=2018”) in new stack
– Executing [s@sub-record-check:7] Set(“SIP/OUT-00000053”, “__TIMESTR=20181026-150837”) in new stack
– Executing [s@sub-record-check:8] Set(“SIP/OUT-00000053”, “__FROMEXTEN=unknown”) in new stack
– Executing [s@sub-record-check:9] Set(“SIP/OUT-00000053”, “__MON_FMT=wav”) in new stack
– Executing [s@sub-record-check:10] NoOp(“SIP/OUT-00000053”, “Recordings initialized”) in new stack
– Executing [s@sub-record-check:11] ExecIf(“SIP/OUT-00000053”, “0?Set(ARG3=dontcare)”) in new stack
– Executing [s@sub-record-check:12] Set(“SIP/OUT-00000053”, “REC_POLICY_MODE_SAVE=”) in new stack
– Executing [s@sub-record-check:13] ExecIf(“SIP/OUT-00000053”, “0?Set(REC_STATUS=NO)”) in new stack
– Executing [s@sub-record-check:14] GotoIf(“SIP/OUT-00000053”, “2?checkaction”) in new stack
– Goto (sub-record-check,s,17)
– Executing [s@sub-record-check:17] GotoIf(“SIP/OUT-00000053”, “1?sub-record-check,in,1”) in new stack
– Goto (sub-record-check,in,1)
– Executing [in@sub-record-check:1] NoOp(“SIP/OUT-00000053”, “Inbound Recording Check to s”) in new stack
– Executing [in@sub-record-check:2] Set(“SIP/OUT-00000053”, “FROMEXTEN=unknown”) in new stack
– Executing [in@sub-record-check:3] ExecIf(“SIP/OUT-00000053”, “6?Set(FROMEXTEN=assist)”) in new stack
– Executing [in@sub-record-check:4] Gosub(“SIP/OUT-00000053”, “recordcheck,1(dontcare,in,s)”) in new stack
– Executing [recordcheck@sub-record-check:1] NoOp(“SIP/OUT-00000053”, “Starting recording check against dontcare”) in new stack
– Executing [recordcheck@sub-record-check:2] Goto(“SIP/OUT-00000053”, “dontcare”) in new stack
– Goto (sub-record-check,recordcheck,3)
– Executing [recordcheck@sub-record-check:3] Return(“SIP/OUT-00000053”, “”) in new stack
– Executing [in@sub-record-check:5] Return(“SIP/OUT-00000053”, “”) in new stack
– Executing [s@ext-did:3] Gosub(“SIP/OUT-00000053”, “app-blacklist-check,s,1()”) in new stack
– Executing [s@app-blacklist-check:1] GotoIf(“SIP/OUT-00000053”, “0?blacklisted”) in new stack
– Executing [s@app-blacklist-check:2] Set(“SIP/OUT-00000053”, “CALLED_BLACKLIST=1”) in new stack
– Executing [s@app-blacklist-check:3] Return(“SIP/OUT-00000053”, “”) in new stack
– Executing [s@ext-did:4] ExecIf(“SIP/OUT-00000053”, “0?Set(__FROM_DID=s)”) in new stack
– Executing [s@ext-did:5] Set(“SIP/OUT-00000053”, “CDR(did)=453xxxxx”) in new stack
– Executing [s@ext-did:6] ExecIf(“SIP/OUT-00000053”, “0 ?Set(CALLERID(name)=assist)”) in new stack
– Executing [s@ext-did:7] Set(“SIP/OUT-00000053”, “CHANNEL(musicclass)=default”) in new stack
– Executing [s@ext-did:8] Set(“SIP/OUT-00000053”, “__MOHCLASS=default”) in new stack
[2018-10-26 15:08:37] WARNING[22910][C-00000038]: func_channel.c:538 func_channel_read: Unknown or unavailable item requested: ‘reversecharge’
– Executing [s@ext-did:9] GotoIf(“SIP/OUT-00000053”, “0?macro-hangupcall”) in new stack
– Executing [s@ext-did:10] Set(“SIP/OUT-00000053”, “__CALLINGPRES_SV=allowed_not_screened”) in new stack
– Executing [s@ext-did:11] Set(“SIP/OUT-00000053”, “CALLERPRES()=allowed_not_screened”) in new stack
– Executing [s@ext-did:12] Goto(“SIP/OUT-00000053”, “from-did-direct,200,1”) in new stack
– Goto (from-did-direct,200,1)
– Executing [200@from-did-direct:1] GotoIf(“SIP/OUT-00000053”, “1?ext-local,200,1”) in new stack
– Goto (ext-local,200,1)
– Executing [200@ext-local:1] Set(“SIP/OUT-00000053”, “__RINGTIMER=15”) in new stack
– Executing [200@ext-local:2] Macro(“SIP/OUT-00000053”, “exten-vm,novm,200,0,0,0”) in new stack
– Executing [s@macro-exten-vm:1] Macro(“SIP/OUT-00000053”, “user-callerid,”) in new stack
– Executing [s@macro-user-callerid:1] Set(“SIP/OUT-00000053”, “TOUCH_MONITOR=1540559317.83”) in new stack
– Executing [s@macro-user-callerid:2] Set(“SIP/OUT-00000053”, “AMPUSER=assist”) in new stack
– Executing [s@macro-user-callerid:3] GotoIf(“SIP/OUT-00000053”, “0?report”) in new stack
– Executing [s@macro-user-callerid:4] ExecIf(“SIP/OUT-00000053”, “1?Set(REALCALLERIDNUM=assist)”) in new stack
– Executing [s@macro-user-callerid:5] Set(“SIP/OUT-00000053”, “AMPUSER=”) in new stack
– Executing [s@macro-user-callerid:6] GotoIf(“SIP/OUT-00000053”, “0?limit”) in new stack
– Executing [s@macro-user-callerid:7] Set(“SIP/OUT-00000053”, “AMPUSERCIDNAME=”) in new stack
– Executing [s@macro-user-callerid:8] GotoIf(“SIP/OUT-00000053”, “1?report”) in new stack
– Goto (macro-user-callerid,s,16)
– Executing [s@macro-user-callerid:16] GotoIf(“SIP/OUT-00000053”, “0?continue”) in new stack
– Executing [s@macro-user-callerid:17] ExecIf(“SIP/OUT-00000053”, “1?Set(__CALLEE_ACCOUNCODE=)”) in new stack
– Executing [s@macro-user-callerid:18] Set(“SIP/OUT-00000053”, “__TTL=64”) in new stack
– Executing [s@macro-user-callerid:19] GotoIf(“SIP/OUT-00000053”, “1?continue”) in new stack
– Goto (macro-user-callerid,s,30)
– Executing [s@macro-user-callerid:30] Set(“SIP/OUT-00000053”, “CALLERID(number)=assist”) in new stack
– Executing [s@macro-user-callerid:31] Set(“SIP/OUT-00000053”, “CALLERID(name)=06970xxxxx”) in new stack
– Executing [s@macro-user-callerid:32] Set(“SIP/OUT-00000053”, “CDR(cnum)=assist”) in new stack
– Executing [s@macro-user-callerid:33] Set(“SIP/OUT-00000053”, “CDR(cnam)=06970xxxxx”) in new stack
– Executing [s@macro-user-callerid:34] Set(“SIP/OUT-00000053”, “CHANNEL(language)=en”) in new stack
– Executing [s@macro-exten-vm:2] Set(“SIP/OUT-00000053”, “RingGroupMethod=none”) in new stack
– Executing [s@macro-exten-vm:3] Set(“SIP/OUT-00000053”, “__EXTTOCALL=200”) in new stack
– Executing [s@macro-exten-vm:4] Set(“SIP/OUT-00000053”, “__PICKUPMARK=200”) in new stack
– Executing [s@macro-exten-vm:5] Set(“SIP/OUT-00000053”, “RT=”) in new stack
– Executing [s@macro-exten-vm:6] ExecIf(“SIP/OUT-00000053”, “0?Macro(vm,novm,DIRECTDIAL,)”) in new stack
– Executing [s@macro-exten-vm:7] ExecIf(“SIP/OUT-00000053”, “0?MacroExit()”) in new stack
– Executing [s@macro-exten-vm:8] Gosub(“SIP/OUT-00000053”, “sub-record-check,s,1(exten,200,dontcare)”) in new stack
– Executing [s@sub-record-check:1] GotoIf(“SIP/OUT-00000053”, “6?initialized”) in new stack
– Goto (sub-record-check,s,10)
– Executing [s@sub-record-check:10] NoOp(“SIP/OUT-00000053”, “Recordings initialized”) in new stack
– Executing [s@sub-record-check:11] ExecIf(“SIP/OUT-00000053”, “0?Set(ARG3=dontcare)”) in new stack
– Executing [s@sub-record-check:12] Set(“SIP/OUT-00000053”, “REC_POLICY_MODE_SAVE=”) in new stack
– Executing [s@sub-record-check:13] ExecIf(“SIP/OUT-00000053”, “0?Set(REC_STATUS=NO)”) in new stack
– Executing [s@sub-record-check:14] GotoIf(“SIP/OUT-00000053”, “5?checkaction”) in new stack
– Goto (sub-record-check,s,17)
– Executing [s@sub-record-check:17] GotoIf(“SIP/OUT-00000053”, “1?sub-record-check,exten,1”) in new stack
– Goto (sub-record-check,exten,1)
– Executing [exten@sub-record-check:1] NoOp(“SIP/OUT-00000053”, “Exten Recording Check between assist and 200”) in new stack
– Executing [exten@sub-record-check:2] Set(“SIP/OUT-00000053”, “CALLTYPE=external”) in new stack
– Executing [exten@sub-record-check:3] ExecIf(“SIP/OUT-00000053”, “0?Set(CALLTYPE=)”) in new stack
– Executing [exten@sub-record-check:4] Set(“SIP/OUT-00000053”, “CALLEE=dontcare”) in new stack
– Executing [exten@sub-record-check:5] ExecIf(“SIP/OUT-00000053”, “0?Set(CALLEE=dontcare)”) in new stack
– Executing [exten@sub-record-check:6] GotoIf(“SIP/OUT-00000053”, “1?callee”) in new stack
– Goto (sub-record-check,exten,11)
– Executing [exten@sub-record-check:11] Gosub(“SIP/OUT-00000053”, “recordcheck,1(dontcare,external,200)”) in new stack
– Executing [recordcheck@sub-record-check:1] NoOp(“SIP/OUT-00000053”, “Starting recording check against dontcare”) in new stack
– Executing [recordcheck@sub-record-check:2] Goto(“SIP/OUT-00000053”, “dontcare”) in new stack
– Goto (sub-record-check,recordcheck,3)
– Executing [recordcheck@sub-record-check:3] Return(“SIP/OUT-00000053”, “”) in new stack
– Executing [exten@sub-record-check:12] Return(“SIP/OUT-00000053”, “”) in new stack
– Executing [s@macro-exten-vm:9] GotoIf(“SIP/OUT-00000053”, “1?macrodial”) in new stack
– Goto (macro-exten-vm,s,15)
– Executing [s@macro-exten-vm:15] GosubIf(“SIP/OUT-00000053”, “0?clrheader,1()”) in new stack
– Executing [s@macro-exten-vm:16] Macro(“SIP/OUT-00000053”, “dial-one,Ttr,200”) in new stack
– Executing [s@macro-dial-one:1] Set(“SIP/OUT-00000053”, “DEXTEN=200”) in new stack
– Executing [s@macro-dial-one:2] Set(“SIP/OUT-00000053”, “DIALSTATUS_CW=”) in new stack
– Executing [s@macro-dial-one:3] GosubIf(“SIP/OUT-00000053”, “0?screen,1()”) in new stack
– Executing [s@macro-dial-one:4] GosubIf(“SIP/OUT-00000053”, “0?cf,1()”) in new stack
– Executing [s@macro-dial-one:5] GotoIf(“SIP/OUT-00000053”, “1?skip1”) in new stack
– Goto (macro-dial-one,s,8)
– Executing [s@macro-dial-one:8] GotoIf(“SIP/OUT-00000053”, “0?nodial”) in new stack
– Executing [s@macro-dial-one:9] GotoIf(“SIP/OUT-00000053”, “0?continue”) in new stack
– Executing [s@macro-dial-one:10] Set(“SIP/OUT-00000053”, “EXTHASCW=ENABLED”) in new stack
– Executing [s@macro-dial-one:11] GotoIf(“SIP/OUT-00000053”, “0?next1:cwinusebusy”) in new stack
– Goto (macro-dial-one,s,23)
– Executing [s@macro-dial-one:23] GotoIf(“SIP/OUT-00000053”, “1?next3:continue”) in new stack
– Goto (macro-dial-one,s,24)
– Executing [s@macro-dial-one:24] ExecIf(“SIP/OUT-00000053”, “0?Set(DIALSTATUS_CW=BUSY)”) in new stack
– Executing [s@macro-dial-one:25] GotoIf(“SIP/OUT-00000053”, “0?nodial”) in new stack
– Executing [s@macro-dial-one:26] GosubIf(“SIP/OUT-00000053”, “1?dstring,1():dlocal,1()”) in new stack
– Executing [dstring@macro-dial-one:1] Set(“SIP/OUT-00000053”, “DSTRING=”) in new stack
– Executing [dstring@macro-dial-one:2] Set(“SIP/OUT-00000053”, “DEVICES=200”) in new stack
– Executing [dstring@macro-dial-one:3] ExecIf(“SIP/OUT-00000053”, “0?Return()”) in new stack
– Executing [dstring@macro-dial-one:4] ExecIf(“SIP/OUT-00000053”, “0?Set(DEVICES=00)”) in new stack
– Executing [dstring@macro-dial-one:5] Set(“SIP/OUT-00000053”, “LOOPCNT=1”) in new stack
– Executing [dstring@macro-dial-one:6] Set(“SIP/OUT-00000053”, “ITER=1”) in new stack
– Executing [dstring@macro-dial-one:7] Set(“SIP/OUT-00000053”, “THISDIAL=SIP/200”) in new stack
– Executing [dstring@macro-dial-one:8] GosubIf(“SIP/OUT-00000053”, “1?zap2dahdi,1()”) in new stack
– Executing [zap2dahdi@macro-dial-one:1] ExecIf(“SIP/OUT-00000053”, “0?Return()”) in new stack
– Executing [zap2dahdi@macro-dial-one:2] Set(“SIP/OUT-00000053”, “NEWDIAL=”) in new stack
– Executing [zap2dahdi@macro-dial-one:3] Set(“SIP/OUT-00000053”, “LOOPCNT2=1”) in new stack
– Executing [zap2dahdi@macro-dial-one:4] Set(“SIP/OUT-00000053”, “ITER2=1”) in new stack
– Executing [zap2dahdi@macro-dial-one:5] Set(“SIP/OUT-00000053”, “THISPART2=SIP/200”) in new stack
– Executing [zap2dahdi@macro-dial-one:6] ExecIf(“SIP/OUT-00000053”, “0?Set(THISPART2=DAHDI/200)”) in new stack
– Executing [zap2dahdi@macro-dial-one:7] Set(“SIP/OUT-00000053”, “NEWDIAL=SIP/200&”) in new stack
– Executing [zap2dahdi@macro-dial-one:8] Set(“SIP/OUT-00000053”, “ITER2=2”) in new stack
– Executing [zap2dahdi@macro-dial-one:9] GotoIf(“SIP/OUT-00000053”, “0?begin2”) in new stack
– Executing [zap2dahdi@macro-dial-one:10] Set(“SIP/OUT-00000053”, “THISDIAL=SIP/200”) in new stack
– Executing [zap2dahdi@macro-dial-one:11] Return(“SIP/OUT-00000053”, “”) in new stack
– Executing [dstring@macro-dial-one:9] GotoIf(“SIP/OUT-00000053”, “1?doset”) in new stack
– Goto (macro-dial-one,dstring,13)
– Executing [dstring@macro-dial-one:13] Set(“SIP/OUT-00000053”, “DSTRING=SIP/200&”) in new stack
– Executing [dstring@macro-dial-one:14] Set(“SIP/OUT-00000053”, “ITER=2”) in new stack
– Executing [dstring@macro-dial-one:15] GotoIf(“SIP/OUT-00000053”, “0?begin”) in new stack
– Executing [dstring@macro-dial-one:16] ExecIf(“SIP/OUT-00000053”, “0?Return()”) in new stack
– Executing [dstring@macro-dial-one:17] Set(“SIP/OUT-00000053”, “DSTRING=SIP/200”) in new stack
– Executing [dstring@macro-dial-one:18] Return(“SIP/OUT-00000053”, “”) in new stack
– Executing [s@macro-dial-one:27] GotoIf(“SIP/OUT-00000053”, “0?nodial”) in new stack
– Executing [s@macro-dial-one:28] GotoIf(“SIP/OUT-00000053”, “0?skiptrace”) in new stack
– Executing [s@macro-dial-one:29] GosubIf(“SIP/OUT-00000053”, “0?ctset,1():ctclear,1()”) in new stack
– Executing [ctclear@macro-dial-one:1] NoOp(“SIP/OUT-00000053”, "Deleting: CALLTRACE/200 ") in new stack
– Executing [ctclear@macro-dial-one:2] Return(“SIP/OUT-00000053”, “”) in new stack
– Executing [s@macro-dial-one:30] Set(“SIP/OUT-00000053”, “D_OPTIONS=Ttr”) in new stack
– Executing [s@macro-dial-one:31] ExecIf(“SIP/OUT-00000053”, “0?SIPAddHeader(Alert-Info: )”) in new stack
– Executing [s@macro-dial-one:32] ExecIf(“SIP/OUT-00000053”, “0?SIPAddHeader()”) in new stack
– Executing [s@macro-dial-one:33] ExecIf(“SIP/OUT-00000053”, “1?Set(CHANNEL(musicclass)=default)”) in new stack
– Executing [s@macro-dial-one:34] GosubIf(“SIP/OUT-00000053”, “0?qwait,1()”) in new stack
– Executing [s@macro-dial-one:35] Set(“SIP/OUT-00000053”, “__CWIGNORE=”) in new stack
– Executing [s@macro-dial-one:36] Set(“SIP/OUT-00000053”, “__KEEPCID=TRUE”) in new stack
– Executing [s@macro-dial-one:37] GotoIf(“SIP/OUT-00000053”, “0?usegoto,1”) in new stack
– Executing [s@macro-dial-one:38] GotoIf(“SIP/OUT-00000053”, “1?godial”) in new stack
– Goto (macro-dial-one,s,43)
– Executing [s@macro-dial-one:43] Macro(“SIP/OUT-00000053”, “dialout-one-predial-hook,”) in new stack
– Executing [s@macro-dialout-one-predial-hook:1] MacroExit(“SIP/OUT-00000053”, “”) in new stack
– Executing [s@macro-dial-one:44] ExecIf(“SIP/OUT-00000053”, “1?Set(D_OPTIONS=trI)”) in new stack
– Executing [s@macro-dial-one:45] Dial(“SIP/OUT-00000053”, “SIP/200,trI”) in new stack
== Using SIP RTP TOS bits 184
== Using SIP RTP CoS mark 5
– Called SIP/200
– Connected line update to SIP/OUT-00000053 prevented.
– SIP/200-00000054 is ringing
== Spawn extension (macro-dial-one, s, 45) exited non-zero on ‘SIP/OUT-00000053’ in macro ‘dial-one’
== Spawn extension (macro-exten-vm, s, 16) exited non-zero on ‘SIP/OUT-00000053’ in macro ‘exten-vm’
== Spawn extension (ext-local, 200, 2) exited non-zero on ‘SIP/OUT-00000053’
– Executing [h@ext-local:1] Macro(“SIP/OUT-00000053”, “hangupcall,”) in new stack
– Executing [s@macro-hangupcall:1] ExecIf(“SIP/OUT-00000053”, “0?Set(CDR(recordingfile)=.wav)”) in new stack
– Executing [s@macro-hangupcall:2] GotoIf(“SIP/OUT-00000053”, “1?theend”) in new stack
– Goto (macro-hangupcall,s,4)
– Executing [s@macro-hangupcall:4] Hangup(“SIP/OUT-00000053”, “”) in new stack
== Spawn extension (macro-hangupcall, s, 4) exited non-zero on ‘SIP/OUT-00000053’ in macro ‘hangupcall’
== Spawn extension (ext-local, h, 1) exited non-zero on ‘SIP/OUT-00000053’

Looks like the CallerID is messed up being sent to you. Make another call but this time do: sip set debug on

We need to see how the CallerID is being present in the SIP message.

Three quick things, only one of which is about your original question:

You should set up a DID-based inbound route for this DID. If all you are using is an “Any/Any” route, that’s fine. Setting up a DID specific inbound route for this specific inbound DID may give you more control over where calls to this number go.

Make sure you set up your firewall to allow this IP address through (assuming this call is from your ITSP) and close off the rest of the Internet from calling in to your PBX. You can do this through the firewall settings by adding this address as a “trusted” address.

The ‘from-trunk’ context is not retrieving a valid Caller ID from the incoming packets. There are several other incoming contexts for inbound routes that use other headers. One of these will probably get you going. I don’t have a definitive list off the top of my head (and the machine I would normally access is “sick” right now - PHP Update mistake). You can check in the /etc/asterisk/extensions-additional.conf file and look for the ‘from-*’ contexts. One of these will probably solve your problem.

That has nothing to do with the Firewall. Friendly Scanner has been around for years before the Firewall. It is related to this:

It is there to tell you that you should really setup an Inbound Route for this DID because it came from a valid source (matched a trunk or came down a PRI) but the system found no routes for it.

1 Like

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