Extension number in outbount CID

Hi

I have the problem that when I made a local call I see the in the outbound CID the extension number (like +23) or unkown, but if I call to a international phone the outbount cid appears properly.

this is the log that I have

[Jun 13 14:43:43] VERBOSE[14929][C-00001909] pbx.c: – Executing [XXXXXXX53498@from-internal:1] Macro(“SIP/23-00003827”, “user-callerid,SKIPTTL,”) in new stack
[Jun 13 14:43:43] VERBOSE[14929][C-00001909] pbx.c: – Executing [s@macro-user-callerid:1] Set(“SIP/23-00003827”, “AMPUSER=23”) in new stack
[Jun 13 14:43:43] VERBOSE[14929][C-00001909] pbx.c: – Executing [s@macro-user-callerid:2] GotoIf(“SIP/23-00003827”, “0?report”) in new stack
[Jun 13 14:43:43] VERBOSE[14929][C-00001909] pbx.c: – Executing [s@macro-user-callerid:3] ExecIf(“SIP/23-00003827”, “1?Set(REALCALLERIDNUM=23)”) in new stack
[Jun 13 14:43:43] VERBOSE[14929][C-00001909] pbx.c: – Executing [s@macro-user-callerid:4] Set(“SIP/23-00003827”, “AMPUSER=23”) in new stack
[Jun 13 14:43:43] VERBOSE[14929][C-00001909] pbx.c: – Executing [s@macro-user-callerid:5] Set(“SIP/23-00003827”, “AMPUSERCIDNAME=Anjali Kapoor”) in new stack
[Jun 13 14:43:43] VERBOSE[14929][C-00001909] pbx.c: – Executing [s@macro-user-callerid:6] GotoIf(“SIP/23-00003827”, “0?report”) in new stack
[Jun 13 14:43:43] VERBOSE[14929][C-00001909] pbx.c: – Executing [s@macro-user-callerid:7] Set(“SIP/23-00003827”, “AMPUSERCID=23”) in new stack
[Jun 13 14:43:43] VERBOSE[14929][C-00001909] pbx.c: – Executing [s@macro-user-callerid:8] Set(“SIP/23-00003827”, “CALLERID(all)=“Anjali Kapoor” <23>”) in new stack
[Jun 13 14:43:43] VERBOSE[14929][C-00001909] pbx.c: – Executing [s@macro-user-callerid:9] ExecIf(“SIP/23-00003827”, “0?Set(CHANNEL(language)=)”) in new stack
[Jun 13 14:43:43] VERBOSE[14929][C-00001909] pbx.c: – Executing [s@macro-user-callerid:10] GotoIf(“SIP/23-00003827”, “1?continue”) in new stack
[Jun 13 14:43:43] VERBOSE[14929][C-00001909] pbx.c: – Goto (macro-user-callerid,s,19)
[Jun 13 14:43:43] VERBOSE[14929][C-00001909] pbx.c: – Executing [s@macro-user-callerid:19] Set(“SIP/23-00003827”, “CALLERID(number)=23”) in new stack
[Jun 13 14:43:43] VERBOSE[14929][C-00001909] pbx.c: – Executing [s@macro-user-callerid:20] Set(“SIP/23-00003827”, “CALLERID(name)=AXXXXX KXXXXX”) in new stack
[Jun 13 14:43:43] VERBOSE[14929][C-00001909] pbx.c: – Executing [s@macro-user-callerid:21] NoOp(“SIP/23-00003827”, “Using CallerID “AXXXX KXXXXXX” <23>”) in new stack
[Jun 13 14:43:43] VERBOSE[14929][C-00001909] pbx.c: – Executing [0041786053498@from-internal:2] NoOp(“SIP/23-00003827”, “Calling Out Route: CH-trunk”) in new stack
[Jun 13 14:43:43] VERBOSE[14929][C-00001909] pbx.c: – Executing [0041786053498@from-internal:3] Set(“SIP/23-00003827”, “MOHCLASS=default”) in new stack
[Jun 13 14:43:43] VERBOSE[14929][C-00001909] pbx.c: – Executing [0041786053498@from-internal:4] Set(“SIP/23-00003827”, “_NODEST=”) in new stack
[Jun 13 14:43:43] VERBOSE[14929][C-00001909] pbx.c: – Executing [0041786053498@from-internal:5] Macro(“SIP/23-00003827”, “record-enable,23,OUT,”) in new stack
[Jun 13 14:43:43] VERBOSE[14929][C-00001909] pbx.c: – Executing [s@macro-record-enable:1] GotoIf(“SIP/23-00003827”, “1?check”) in new stack
[Jun 13 14:43:43] VERBOSE[14929][C-00001909] pbx.c: – Goto (macro-record-enable,s,4)
[Jun 13 14:43:43] VERBOSE[14929][C-00001909] pbx.c: – Executing [s@macro-record-enable:4] ExecIf(“SIP/23-00003827”, “0?MacroExit()”) in new stack
[Jun 13 14:43:43] VERBOSE[14929][C-00001909] pbx.c: – Executing [s@macro-record-enable:5] GotoIf(“SIP/23-00003827”, “0?Group:OUT”) in new stack
[Jun 13 14:43:43] VERBOSE[14929][C-00001909] pbx.c: – Goto (macro-record-enable,s,15)
[Jun 13 14:43:43] VERBOSE[14929][C-00001909] pbx.c: – Executing [s@macro-record-enable:15] GotoIf(“SIP/23-00003827”, “0?IN”) in new stack
[Jun 13 14:43:43] VERBOSE[14929][C-00001909] pbx.c: – Executing [s@macro-record-enable:16] ExecIf(“SIP/23-00003827”, “1?MacroExit()”) in new stack
[Jun 13 14:43:43] VERBOSE[14929][C-00001909] pbx.c: – Executing [0041786053498@from-internal:6] Macro(“SIP/23-00003827”, “dialout-trunk,4,XXXXXX3498,”) in new stack
[Jun 13 14:43:43] VERBOSE[14929][C-00001909] pbx.c: – Executing [s@macro-dialout-trunk:1] Set(“SIP/23-00003827”, “DIAL_TRUNK=4”) in new stack
[Jun 13 14:43:43] VERBOSE[14929][C-00001909] pbx.c: – Executing [s@macro-dialout-trunk:2] GosubIf(“SIP/23-00003827”, “0?sub-pincheck,s,1”) in new stack
[Jun 13 14:43:43] VERBOSE[14929][C-00001909] pbx.c: – Executing [s@macro-dialout-trunk:3] GotoIf(“SIP/23-00003827”, “0?disabletrunk,1”) in new stack
[Jun 13 14:43:43] VERBOSE[14929][C-00001909] pbx.c: – Executing [s@macro-dialout-trunk:4] Set(“SIP/23-00003827”, “DIAL_NUMBER=XXXXXXXXX3498”) in new stack
[Jun 13 14:43:43] VERBOSE[14929][C-00001909] pbx.c: – Executing [s@macro-dialout-trunk:5] Set(“SIP/23-00003827”, “DIAL_TRUNK_OPTIONS=tr”) in new stack
[Jun 13 14:43:43] VERBOSE[14929][C-00001909] pbx.c: – Executing [s@macro-dialout-trunk:6] Set(“SIP/23-00003827”, “OUTBOUND_GROUP=OUT_4”) in new stack
[Jun 13 14:43:43] VERBOSE[14929][C-00001909] pbx.c: – Executing [s@macro-dialout-trunk:7] GotoIf(“SIP/23-00003827”, “1?nomax”) in new stack
[Jun 13 14:43:43] VERBOSE[14929][C-00001909] pbx.c: – Goto (macro-dialout-trunk,s,9)
[Jun 13 14:43:43] VERBOSE[14929][C-00001909] pbx.c: – Executing [s@macro-dialout-trunk:9] GotoIf(“SIP/23-00003827”, “0?skipoutcid”) in new stack
[Jun 13 14:43:43] VERBOSE[14929][C-00001909] pbx.c: – Executing [s@macro-dialout-trunk:10] Set(“SIP/23-00003827”, “DIAL_TRUNK_OPTIONS=”) in new stack
[Jun 13 14:43:43] VERBOSE[14929][C-00001909] pbx.c: – Executing [s@macro-dialout-trunk:11] Macro(“SIP/23-00003827”, “outbound-callerid,4”) in new stack
[Jun 13 14:43:43] VERBOSE[14929][C-00001909] pbx.c: – Executing [s@macro-outbound-callerid:1] ExecIf(“SIP/23-00003827”, “0?Set(CALLERPRES()=)”) in new stack
[Jun 13 14:43:43] VERBOSE[14929][C-00001909] pbx.c: – Executing [s@macro-outbound-callerid:2] ExecIf(“SIP/23-00003827”, “0?Set(REALCALLERIDNUM=AXXX KXXXX)”) in new stack
[Jun 13 14:43:43] VERBOSE[14929][C-00001909] pbx.c: – Executing [s@macro-outbound-callerid:3] GotoIf(“SIP/23-00003827”, “1?normcid”) in new stack
[Jun 13 14:43:43] VERBOSE[14929][C-00001909] pbx.c: – Goto (macro-outbound-callerid,s,6)
[Jun 13 14:43:43] VERBOSE[14929][C-00001909] pbx.c: – Executing [s@macro-outbound-callerid:6] Set(“SIP/23-00003827”, “USEROUTCID=XXXXXX005763”) in new stack
[Jun 13 14:43:43] VERBOSE[14929][C-00001909] pbx.c: – Executing [s@macro-outbound-callerid:7] Set(“SIP/23-00003827”, “EMERGENCYCID=”) in new stack
[Jun 13 14:43:43] VERBOSE[14929][C-00001909] pbx.c: – Executing [s@macro-outbound-callerid:8] Set(“SIP/23-00003827”, “TRUNKOUTCID=”) in new stack
[Jun 13 14:43:43] VERBOSE[14929][C-00001909] pbx.c: – Executing [s@macro-outbound-callerid:9] GotoIf(“SIP/23-00003827”, “1?trunkcid”) in new stack
[Jun 13 14:43:43] VERBOSE[14929][C-00001909] pbx.c: – Goto (macro-outbound-callerid,s,12)
[Jun 13 14:43:43] VERBOSE[14929][C-00001909] pbx.c: – Executing [s@macro-outbound-callerid:12] ExecIf(“SIP/23-00003827”, “0?Set(CALLERID(name)=)”) in new stack
[Jun 13 14:43:43] VERBOSE[14929][C-00001909] pbx.c: – Executing [s@macro-outbound-callerid:13] ExecIf(“SIP/23-00003827”, “1?Set(CALLERID(name)=XXXXX5763)”) in new stack

and this is my macro-outbound-callerid:

[macro-outbound-callerid]
include => macro-outbound-callerid-custom
exten => s,1,ExecIf($["${CALLINGPRES_SV}" != “”]?Set(CALLERPRES()=${CALLINGPRES_SV}))
exten => s,n,ExecIf($["${REALCALLERIDNUM:1:2}" = “”]?Set(REALCALLERIDNUM=${CALLERID(name)}))
exten => s,n(start),GotoIf($[ $["${REALCALLERIDNUM}" = “”] | $["${KEEPCID}" != “TRUE”] | $["${OUTKEEPCID_${ARG1}}" = “on”] ]?normcid)
exten => s,n,Set(USEROUTCID=${REALCALLERIDNUM})
exten => s,n,GotoIf($[“foo${DB(AMPUSER/${REALCALLERIDNUM}/device)}” = “foo”]?bypass)
exten => s,n(normcid),Set(USEROUTCID=${DB(AMPUSER/${AMPUSER}/outboundcid)})
exten => s,n(bypass),Set(EMERGENCYCID=${DB(DEVICE/${REALCALLERIDNUM}/emergency_cid)})
exten => s,n,Set(TRUNKOUTCID=${OUTCID_${ARG1}})
exten => s,n,GotoIf($["${EMERGENCYROUTE:1:2}" = “” | “${EMERGENCYCID:1:2}” = “”]?trunkcid)
exten => s,n,Set(CALLERID(all)=${EMERGENCYCID})
exten => s,n(exit),MacroExit()
exten => s,n(trunkcid),ExecIf($[${LEN(${TRUNKOUTCID})} != 0]?Set(CALLERID(name)=${TRUNKOUTCID}))
exten => s,n(usercid),ExecIf($[${LEN(${USEROUTCID})} != 0]?Set(CALLERID(name)=${USEROUTCID}))
exten => s,n,ExecIf($[${LEN(${TRUNKCIDOVERRIDE})} != 0 | ${LEN(${FORCEDOUTCID_${ARG1}})} != 0]?Set(CALLERID(all)=${IF($[${LEN(${FORCEDOUTCID_${ARG1}})}=0]?${TRUNKCIDOVER$
exten => s,n(hidecid),ExecIf($["${CALLERID(name)}"=“hidden”]?Set(CALLERPRES()=prohib_passed_screen))

; end of [macro-outbound-callerid]

Thank you very much!

Looks like a FreePBX dialplan. In which case use freepbx.org/forums/

Otherwise, you will need to contact the dialplan author, or, in the last resort, provide the complete dialplan here.

Hi David55,

Thanks very much for you support. Some months before I hat the problem that the trunk always shows the default number (viewtopic.php?f=1&t=89925) And I follow your instructions, made these macro-outbound-callerid and run.

Now the problem is with other trunk for other country, that for some phones shows the extension number and for other shows “unknow” and the logs for both are the same, and when I compare it with the logs of the “good trunk” are the same too.

with the dial plan, you mean the extensions.conf?

Best regards

Dialplan means extensions.conf, and any file that it includes. There are also alternatives to extensions.conf, like extensions.ael, that really ought to be included, too.

If this is a FreePBX dialplan, you really need to get support from the FreePBX community, as piecemeal changes are likely to break it.

Otherwise, given the size of the dialplan, my gut feeling is that working out the problem will take longer than the couple of minutes people are prepared to give towards free support.

Hi David55,

Thanks very much for your response. I’m using Elastix that have a freepbx disto too… I have open a new topic in the freepbx forum.

Thanks very much for your support

Hi I found the solution. It was add the line

exten => s,n(usercid),ExecIf($[${LEN(${USEROUTCID})} != 0]?set(CALLERID(num)=${USEROUTCID})):

My definitive macro-outbound-callerid is:

[macro-outbound-callerid]
include => macro-outbound-callerid-custom
exten => s,1,ExecIf($["${CALLINGPRES_SV}" != “”]?Set(CALLERPRES()=${CALLINGPRES_SV}))
exten => s,n,ExecIf($["${REALCALLERIDNUM:1:2}" = “”]?Set(REALCALLERIDNUM=${CALLERID(name)}))
exten => s,n(start),GotoIf($[ $["${REALCALLERIDNUM}" = “”] | $["${KEEPCID}" != “TRUE”] | $["${OUTKEEPCID_${ARG1}}" = “on”] ]?normcid)
exten => s,n,Set(USEROUTCID=${REALCALLERIDNUM})
exten => s,n,GotoIf($[“foo${DB(AMPUSER/${REALCALLERIDNUM}/device)}” = “foo”]?bypass)
exten => s,n(normcid),Set(USEROUTCID=${DB(AMPUSER/${AMPUSER}/outboundcid)})
exten => s,n(bypass),Set(EMERGENCYCID=${DB(DEVICE/${REALCALLERIDNUM}/emergency_cid)})
exten => s,n,Set(TRUNKOUTCID=${OUTCID_${ARG1}})
exten => s,n,GotoIf($["${EMERGENCYROUTE:1:2}" = “” | “${EMERGENCYCID:1:2}” = “”]?trunkcid)
exten => s,n,Set(CALLERID(all)=${EMERGENCYCID})
exten => s,n(exit),MacroExit()
exten => s,n(trunkcid),ExecIf($[${LEN(${TRUNKOUTCID})} != 0]?Set(CALLERID(name)=${TRUNKOUTCID}))
exten => s,n(usercid),ExecIf($[${LEN(${USEROUTCID})} != 0]?Set(CALLERID(num)=${USEROUTCID}))
exten => s,n(usercid),ExecIf($[${LEN(${USEROUTCID})} != 0]?Set(CALLERID(name)=${USEROUTCID}))
exten => s,n,ExecIf($[${LEN(${TRUNKCIDOVERRIDE})} != 0 | ${LEN(${FORCEDOUTCID_${ARG1}})} != 0]?Set(CALLERID(all)=${IF($[${LEN(${FORCEDOUTCID_${ARG1}})}=0]?${TRUNKCIDOVERRIDE}:${FORCEDOUTCID_${ARG1}})}))
exten => s,n(hidecid),ExecIf($["${CALLERID(name)}"=“hidden”]?Set(CALLERPRES()=prohib_passed_screen))

; end of [macro-outbound-callerid]

Regards

That macro isn’t part of Asterisk. It might be part of FreePBX.