Random display caller id

i have a few number to display as below, do you all experience to enable this random display number?

017xxxx011
017xxxx021
017xxxx025

Use code as an example, it not exactly an step by step guide for what you want but it covers all the necesary steps

[outbound]
exten=>_x.,1,Gosub(cid-exten,${CALLERID(num)},1)
exten=>_x.,2,Dial(SIP/trunk/${EXTEN})

[cid-exten]
exten =>101,1,ExecIf($["${CALLERID(NUM)}"= β€œ101”]?Set(CALLERID(num)=15619230427))
same => n,Return

exten =>102,1,ExecIf($["${CALLERID(NUM)}"= β€œ102”]?Set(CALLERID(num)=15619230443))
same => n,Return

exten =>103,1,ExecIf($["${CALLERID(NUM)}"= β€œ103”]?Set(CALLERID(num)=15619230473))
same => n,Return

may i know which file should i write to?

If you dont know you need to write this on extensions.conf file, you wont be capable to customize this example code to your needs, so please go to http://www.asteriskdocs.org/

1 Like

i has been write the code into extension.conf, but test with result also come out with the main pilot number. Besides, i also set replace the 101,102, and 103 into my current extension 8888 also getting same result. may i know whether have any other thing need to change?

you need to post your dialplan as well console ouput and also what technology are you using SIP, DAHDI , IAX2 or something else ?

Im using sip trunk technology. below is the info

– Executing [90164219012@from-internal:1] Macro (" SIP/8888-00000041 ", " user-callerid,LIMIT,EXTERNAL, ") in new stack

– Executing [s@macro-user-callerid:1] Set (" SIP/8888-00000041 ", " TOUCH_MONITOR=1538193909.67 ") in new stack

– Executing [s@macro-user-callerid:2] Set (" SIP/8888-00000041 ", " AMPUSER=8888 ") in new stack

– Executing [s@macro-user-callerid:3] GotoIf (" SIP/8888-00000041 ", " 0?report ") in new stack

– Executing [s@macro-user-callerid:4] ExecIf (" SIP/8888-00000041 ", " 1?Set(REALCALLERIDNUM=8888) ") in new stack

– Executing [s@macro-user-callerid:5] Set (" SIP/8888-00000041 ", " AMPUSER=8888 ") in new stack

– Executing [s@macro-user-callerid:6] GotoIf (" SIP/8888-00000041 ", " 0?limit ") in new stack

– Executing [s@macro-user-callerid:7] Set (" SIP/8888-00000041 ", " AMPUSERCIDNAME=jason leong ") in new stack

– Executing [s@macro-user-callerid:8] GotoIf (" SIP/8888-00000041 ", " 0?report ") in new stack

– Executing [s@macro-user-callerid:9] Set (" SIP/8888-00000041 ", " AMPUSERCID=8888 ") in new stack

– Executing [s@macro-user-callerid:10] Set (" SIP/8888-00000041 ", " __DIAL_OPTIONS=tr ") in new stack

– Executing [s@macro-user-callerid:11] Set (" SIP/8888-00000041 ", " CALLERID(all)=β€œjason leong” <8888> ") in new stack

– Executing [s@macro-user-callerid:12] GotoIf (" SIP/8888-00000041 ", " 0?limit ") in new stack

– Executing [s@macro-user-callerid:13] ExecIf (" SIP/8888-00000041 ", " 1?Set(GROUP(concurrency_limit)=8888) ") in new stack

– Executing [s@macro-user-callerid:14] ExecIf (" SIP/8888-00000041 ", " 0?Set(CHANNEL(language)=) ") in new stack

– Executing [s@macro-user-callerid:15] GotoIf (" SIP/8888-00000041 ", " 1?continue ") in new stack

– Goto (macro-user-callerid,s,28)

– Executing [s@macro-user-callerid:28] Set (" SIP/8888-00000041 ", " CALLERID(number)=8888 ") in new stack

– Executing [s@macro-user-callerid:29] Set (" SIP/8888-00000041 ", " CALLERID(name)=jason leong ") in new stack

– Executing [s@macro-user-callerid:30] Set (" SIP/8888-00000041 ", " CDR(cnum)=8888 ") in new stack

– Executing [s@macro-user-callerid:31] Set (" SIP/8888-00000041 ", " CDR(cnam)=jason leong ") in new stack

– Executing [s@macro-user-callerid:32] Set (" SIP/8888-00000041 ", " CHANNEL(language)=en ") in new stack

– Executing [90164219012@from-internal:2] Set (" SIP/8888-00000041 ", " MOHCLASS=default ") in new stack

– Executing [90164219012@from-internal:3] Set (" SIP/8888-00000041 ", " _NODEST= ") in new stack

– Executing [90164219012@from-internal:4] Gosub (" SIP/8888-00000041 ", " sub-record-check,s,1(out,90164219012,) ") in new stack

– Executing [s@sub-record-check:1] Set (" SIP/8888-00000041 ", " REC_POLICY_MODE_SAVE= ") in new stack

– Executing [s@sub-record-check:2] GotoIf (" SIP/8888-00000041 ", " 1?check ") in new stack

– Goto (sub-record-check,s,7)

– Executing [s@sub-record-check:7] Set (" SIP/8888-00000041 ", " __MON_FMT=wav ") in new stack

– Executing [s@sub-record-check:8] GotoIf (" SIP/8888-00000041 ", " 1?next ") in new stack

– Goto (sub-record-check,s,11)

– Executing [s@sub-record-check:11] ExecIf (" SIP/8888-00000041 ", " 0?Return() ") in new stack

– Executing [s@sub-record-check:12] ExecIf (" SIP/8888-00000041 ", " 0?Set(__REC_POLICY_MODE=) ") in new stack

– Executing [s@sub-record-check:13] GotoIf (" SIP/8888-00000041 ", " 0?out,1 ") in new stack

– Executing [s@sub-record-check:14] Set (" SIP/8888-00000041 ", " __REC_STATUS=INITIALIZED ") in new stack

– Executing [s@sub-record-check:15] Set (" SIP/8888-00000041 ", " NOW=1538193909 ") in new stack

– Executing [s@sub-record-check:16] Set (" SIP/8888-00000041 ", " __DAY=29 ") in new stack

– Executing [s@sub-record-check:17] Set (" SIP/8888-00000041 ", " __MONTH=09 ") in new stack

– Executing [s@sub-record-check:18] Set (" SIP/8888-00000041 ", " __YEAR=2018 ") in new stack

– Executing [s@sub-record-check:19] Set (" SIP/8888-00000041 ", " __TIMESTR=20180929-120509 ") in new stack

– Executing [s@sub-record-check:20] Set (" SIP/8888-00000041 ", " __FROMEXTEN=8888 ") in new stack

– Executing [s@sub-record-check:21] Set (" SIP/8888-00000041 ", " __CALLFILENAME=out-90164219012-8888-20180929-120509-1538193909.67 ") in new stack

– Executing [s@sub-record-check:22] Goto (" SIP/8888-00000041 ", " out,1 ") in new stack

– Goto (sub-record-check,out,1)

– Executing [out@sub-record-check:1] ExecIf (" SIP/8888-00000041 ", " 1?Set(__REC_POLICY_MODE=dontcare) ") in new stack

– Executing [out@sub-record-check:2] GosubIf (" SIP/8888-00000041 ", " 0?record,1(exten,90164219012,8888) ") in new stack

– Executing [out@sub-record-check:3] Return (" SIP/8888-00000041 ", β€œβ€) in new stack

– Executing [90164219012@from-internal:5] Macro (" SIP/8888-00000041 ", " dialout-trunk,3,0164219012,off ") in new stack

– Executing [s@macro-dialout-trunk:1] Set (" SIP/8888-00000041 ", " DIAL_TRUNK=3 ") in new stack

– Executing [s@macro-dialout-trunk:2] GosubIf (" SIP/8888-00000041 ", " 0?sub-pincheck,s,1() ") in new stack

– Executing [s@macro-dialout-trunk:3] GotoIf (" SIP/8888-00000041 ", " 0?disabletrunk,1 ") in new stack

– Executing [s@macro-dialout-trunk:4] Set (" SIP/8888-00000041 ", " DIAL_NUMBER=0164219012 ") in new stack

– Executing [s@macro-dialout-trunk:5] Set (" SIP/8888-00000041 ", " DIAL_TRUNK_OPTIONS=tr ") in new stack

– Executing [s@macro-dialout-trunk:6] Set (" SIP/8888-00000041 ", " OUTBOUND_GROUP=OUT_3 ") in new stack

– Executing [s@macro-dialout-trunk:7] GotoIf (" SIP/8888-00000041 ", " 1?nomax ") in new stack

– Goto (macro-dialout-trunk,s,9)

– Executing [s@macro-dialout-trunk:9] GotoIf (" SIP/8888-00000041 ", " 0?skipoutcid ") in new stack

– Executing [s@macro-dialout-trunk:10] Set (" SIP/8888-00000041 ", " DIAL_TRUNK_OPTIONS= ") in new stack

– Executing [s@macro-dialout-trunk:11] Macro (" SIP/8888-00000041 ", " outbound-callerid,3 ") in new stack

– Executing [s@macro-outbound-callerid:1] ExecIf (" SIP/8888-00000041 ", " 0?Set(CALLERPRES()=) ") in new stack

– Executing [s@macro-outbound-callerid:2] ExecIf (" SIP/8888-00000041 ", " 0?Set(REALCALLERIDNUM=8888) ") in new stack

– Executing [s@macro-outbound-callerid:3] GotoIf (" SIP/8888-00000041 ", " 1?normcid ") in new stack

– Goto (macro-outbound-callerid,s,6)

– Executing [s@macro-outbound-callerid:6] Set (" SIP/8888-00000041 ", " USEROUTCID= ") in new stack

– Executing [s@macro-outbound-callerid:7] Set (" SIP/8888-00000041 ", " EMERGENCYCID= ") in new stack

– Executing [s@macro-outbound-callerid:8] Set (" SIP/8888-00000041 ", " TRUNKOUTCID= ") in new stack

– Executing [s@macro-outbound-callerid:9] GotoIf (" SIP/8888-00000041 ", " 1?trunkcid ") in new stack

– Goto (macro-outbound-callerid,s,14)

– Executing [s@macro-outbound-callerid:14] ExecIf (" SIP/8888-00000041 ", " 0?Set(CALLERID(all)=) ") in new stack

– Executing [s@macro-outbound-callerid:15] ExecIf (" SIP/8888-00000041 ", " 0?Set(CALLERID(all)=) ") in new stack

– Executing [s@macro-outbound-callerid:16] ExecIf (" SIP/8888-00000041 ", " 0?Set(CALLERID(all)=) ") in new stack

– Executing [s@macro-outbound-callerid:17] ExecIf (" SIP/8888-00000041 ", " 0?Set(CALLERPRES()=prohib_passed_screen) ") in new stack

– Executing [s@macro-outbound-callerid:18] Set (" SIP/8888-00000041 ", " CDR(outbound_cnum)=8888 ") in new stack

– Executing [s@macro-outbound-callerid:19] Set (" SIP/8888-00000041 ", " CDR(outbound_cnam)=jason leong ") in new stack

– Executing [s@macro-dialout-trunk:12] GosubIf (" SIP/8888-00000041 ", " 0?sub-flp-3,s,1() ") in new stack

– Executing [s@macro-dialout-trunk:13] Set (" SIP/8888-00000041 ", " OUTNUM=0164219012 ") in new stack

– Executing [s@macro-dialout-trunk:14] Set (" SIP/8888-00000041 ", " custom=SIP/0378901755 ") in new stack

– Executing [s@macro-dialout-trunk:15] ExecIf (" SIP/8888-00000041 ", " 0?Set(DIAL_TRUNK_OPTIONS=M(setmusic^default)) ") in new stack

– Executing [s@macro-dialout-trunk:16] ExecIf (" SIP/8888-00000041 ", " 0?Set(DIAL_TRUNK_OPTIONS=M(confirm)) ") in new stack

– Executing [s@macro-dialout-trunk:17] Macro (" SIP/8888-00000041 ", " dialout-trunk-predial-hook, ") in new stack

– Executing [s@macro-dialout-trunk-predial-hook:1] MacroExit (" SIP/8888-00000041 ", β€œβ€) in new stack

– Executing [s@macro-dialout-trunk:18] GotoIf (" SIP/8888-00000041 ", " 0?bypass,1 ") in new stack

– Executing [s@macro-dialout-trunk:19] ExecIf (" SIP/8888-00000041 ", " 1?Set(CONNECTEDLINE(num,i)=0164219012) ") in new stack

– Executing [s@macro-dialout-trunk:20] ExecIf (" SIP/8888-00000041 ", " 1?Set(CONNECTEDLINE(name,i)=CID:8888) ") in new stack

– Executing [s@macro-dialout-trunk:21] GotoIf (" SIP/8888-00000041 ", " 0?customtrunk ") in new stack

– Executing [s@macro-dialout-trunk:22] Dial (" SIP/8888-00000041 ", " SIP/0378901755/0164219012,300, ") in new stack

== Using SIP RTP TOS bits 184

== Using SIP RTP CoS mark 5

– Called SIP/0378901755/0164219012

– SIP/0378901755-00000042 is making progress passing it to SIP/8888-00000041

> 0x7fdd30014710 – Probation passed - setting RTP source address to 103.251.203.148:37914

> 0x7fdd380029c0 – Probation passed - setting RTP source address to 219.92.2.189:33781

> 0x7fdd380029c0 – Probation passed - setting RTP source address to 219.92.2.189:33781

== Spawn extension (macro-dialout-trunk, s, 22) exited non-zero on β€˜SIP/8888-00000041’ in macro β€˜dialout-trunk’

== Spawn extension (from-internal, 90164219012, 5) exited non-zero on β€˜SIP/8888-00000041’

– Executing [h@from-internal:1] Hangup (" SIP/8888-00000041 ", β€œβ€) in new stack

== Spawn extension (from-internal, h, 1) exited non-zero on β€˜SIP/8888-00000041’

You are using FreePBX, which isn’t supported here and may well conflict. Use https://community.freepbx.org/ for peer support on FreePBX.

Also, you may find that your service provider is overriding the caller ID, to prevent you from spoofing caller ID’s that you do not own.

1 Like