Help: How to set outgoing caller number from PRI

Dear All Asterisk Pro,

I need another help with regarding outgoing caller number from Pri line.
My Pri line have 200 numbers subscription 067680000 until 067680199 with main line 067680088

What I want to do is that from specific extensions example extensions 119 calling out with number 067680119, extensions number 101 dial out with 067680101.

I had tried with the following but receiver still saw the main line number only with 067680088
Anything I set wrong?

[macro-dialTrunk]
exten = s, 1, AGI(ehors/setCallerID.php)
exten = s, n, AGI(ehors/isExtensionActive.php)

exten = s, n, GotoIf($["${CALLERID(number)}" = "119"]?11:90)
exten = s, n, GotoIf($["${CALLERID(number)}" = "118"]?13:90)

exten = s, 11, Set(CALLERID(all)="Charlie Test" <067680019>)
exten = s, 12, Goto(s, 101)
exten = s, 13, Set(CALLERID(all)="Bosco Test" <067680018>)
exten = s, 14, Goto(s, 101)

exten = s, 90, Set(CALLERID(all)="Palm Seremban Hotel" <067680088>)
exten = s, 91, Goto(s, 101)

exten = s, 101, Dial(${ARG2}/${ARG3}, ${ARG4})
exten = s, 102, Goto(s-${DIALSTATUS}, 1)
exten = s-CHANUNAVAIL, 1, Playback(number-not-answering)
exten = s-CHANUNAVAIL, n, Congestion(60)
exten = s-NOANSWER, 1, Playback(number-not-answering)
exten = s-NOANSWER, n, Congestion(60)
exten = s-BUSY, 1, Playback(the-number-u-dialed&is-curntly-busy)
exten = s-BUSY, n, Congestion(60)
exten = s-., 1, Hangup

My pri line settings are as following POST: --> viewtopic.php?f=1&t=90699

Many many thanks in advance.

The most likely reason is that your service provider doesn’t allow this. Otherwise, please provide the application level protocol trace so that we can see what is actually being sent.

Try replacing CALLERID(number) with CALLERID(num) in your dialplan. I beleive ‘number’ is deprecated.

–Satish Barot

Still supported in trunk:

} else if (!strncasecmp("num", argv[0], 3)) { /* Accept num[ber] */

In any case, deprecated implies it is still accepted.

Dear All,

From PRI debug, I got this:

From summary, I saw:

Looks like its passed???

Do national numbers really start with 0? They don’t in the UK; 0 is an access code, not part of the national number. The incoming numbers is has an unknown type of number, so including access codes is reasonable.

Dear David,

I had already tried many kinds of combinations, in my number format
06 - District Area code
768 - Area prefix
0000 - 0199 (Pri 200 numbers subscriptions)

I did tried with setting caller ID to 067680019, 7680019, 67860019, 0019… in Pri debug all show the same message on SETUP part:

And… all kind of combination made doesn’t effect calling out with the main number 067680088.

If you are sure the type and number and number are correct in the trace, your network operator is treating the number as untrusted and ignoring it.

Dear David,

I made a try again as from my Provider email:

Now I have the " Presentation: Presentation allowed, User-provided, not screened (0) ‘0019’" What does it mean by “Not Screened”? I tried with function SetCallerPres() but I believe this function had been deprecated right?

PRI Span: 1 -- Making new call for cref 32789
    -- Requested transfer capability: 0x00 - SPEECH
PRI Span: 1 
PRI Span: 1 > DL-DATA request
PRI Span: 1 > Protocol Discriminator: Q.931 (8)  len=36
PRI Span: 1 > TEI=0 Call Ref: len= 2 (reference 21/0x15) (Sent from originator)
PRI Span: 1 > Message Type: SETUP (5)
PRI Span: 1 TEI=0 Transmitting N(S)=68, window is open V(A)=68 K=7
PRI Span: 1 
PRI Span: 1 > Protocol Discriminator: Q.931 (8)  len=36
PRI Span: 1 > TEI=0 Call Ref: len= 2 (reference 21/0x15) (Sent from originator)
PRI Span: 1 > Message Type: SETUP (5)
PRI Span: 1 > [04 03 80 90 a3]
PRI Span: 1 > Bearer Capability (len= 5) [ Ext: 1  Coding-Std: 0  Info transfer capability: Speech (0)
PRI Span: 1 >                              Ext: 1  Trans mode/rate: 64kbps, circuit-mode (16)
PRI Span: 1 >                                User information layer 1: A-Law (35)
PRI Span: 1 > [18 03 a1 83 81]
PRI Span: 1 > Channel ID (len= 5) [ Ext: 1  IntID: Implicit  Other(PRI)  Spare: 0  Preferred  Dchan: 0
PRI Span: 1 >                       ChanSel: As indicated in following octets
PRI Span: 1 >                       Ext: 1  Coding: 0  Number Specified  Channel Type: 3
PRI Span: 1 >                       Ext: 1  Channel: 1 Type: CPE]
PRI Span: 1 > [6c 06 41 80 30 30 31 39]
PRI Span: 1 > Calling Party Number (len= 8) [ Ext: 0  TON: Subscriber Number (4)  NPI: ISDN/Telephony Numbering Plan (E.164/E.163) (1)
PRI Span: 1 >                                 Presentation: Presentation allowed, User-provided, not screened (0)  '0019' ]
PRI Span: 1 > [70 0b 80 30 31 36 32 32 39 30 34 36 35]
PRI Span: 1 > Called Party Number (len=13) [ Ext: 1  TON: Unknown Number Type (0)  NPI: Unknown Number Plan (0)  '0162290465' ]
PRI Span: 1 q931.c:6291 q931_setup: Call 32789 enters state 1 (Call Initiated).  Hold state: Idle
    -- Called DAHDI/g1/0162290465
PRI Span: 1 
PRI Span: 1 < Protocol Discriminator: Q.931 (8)  len=10
PRI Span: 1 < TEI=0 Call Ref: len= 2 (reference 21/0x15) (Sent to originator)
PRI Span: 1 < Message Type: SETUP ACKNOWLEDGE (13)
PRI Span: 1 < [18 03 a9 83 81]
PRI Span: 1 < Channel ID (len= 5) [ Ext: 1  IntID: Implicit  Other(PRI)  Spare: 0  Exclusive  Dchan: 0
PRI Span: 1 <                       ChanSel: As indicated in following octets
PRI Span: 1 <                       Ext: 1  Coding: 0  Number Specified  Channel Type: 3
PRI Span: 1 <                       Ext: 1  Channel: 1 Type: CPE]
PRI Span: 1 Received message for call 0x2b4e44a79810 on link 0x2b4e600167c0 TEI/SAPI 0/0
PRI Span: 1 -- Processing IE 24 (cs0, Channel ID)
PRI Span: 1 q931.c:9141 post_handle_q931_message: Call 32789 enters state 2 (Overlap Sending).  Hold state: Idle
Span: 1 Processing event: PRI_EVENT_SETUP_ACK
    -- DAHDI/i1/0162290465-17 is making progress passing it to SIP/119-00000027
PRI Span: 1 
PRI Span: 1 < Protocol Discriminator: Q.931 (8)  len=10
PRI Span: 1 < TEI=0 Call Ref: len= 2 (reference 21/0x15) (Sent to originator)
PRI Span: 1 < Message Type: CALL PROCEEDING (2)
PRI Span: 1 < [18 03 a9 83 81]
PRI Span: 1 < Channel ID (len= 5) [ Ext: 1  IntID: Implicit  Other(PRI)  Spare: 0  Exclusive  Dchan: 0
PRI Span: 1 <                       ChanSel: As indicated in following octets
PRI Span: 1 <                       Ext: 1  Coding: 0  Number Specified  Channel Type: 3
PRI Span: 1 <                       Ext: 1  Channel: 1 Type: CPE]
PRI Span: 1 Received message for call 0x2b4e44a79810 on link 0x2b4e600167c0 TEI/SAPI 0/0
PRI Span: 1 -- Processing IE 24 (cs0, Channel ID)
PRI Span: 1 q931.c:8776 post_handle_q931_message: Call 32789 enters state 3 (Outgoing Call Proceeding).  Hold state: Idle

“Not screened” means the sender hasn’t checked that the number actually belongs to the upstream party.

Although it may not matter, the numbering plan is bogus if you are only sending four digits.

Use Set(CALERID(xxx)=

Ok, but in my dial plan I had already have the following still cannot make the outbound caller ID to the number I wanted.

“all” really only means name and num. (If I look deeper, it might invalidate screened.)

Dear David,

Sorry for my knowledge of asterisk. Which mean how shall I present my dial trunk call with caller ID? I saw from voip-info.org I can have the xxx following options: How shall I really do? Make 2 line of SET(CALLERID(xxx( ?

Many thanks again.

[quote]all
name
name-valid
name-charset
name-pres
num
num-valid
num-plan
num-pres
subaddr
subaddr-valid
subaddr-type
subaddr-odd
tag
ANI-all
ANI-name
ANI-name-valid
ANI-name-charset
ANI-name-pres
ANI-num
ANI-num-valid
ANI-num-plan
ANI-num-pres
ANI-tag
RDNIS
DNID
dnid-num-plan
dnid-subaddr
dnid-subaddr-valid
dnid-subaddr-type
dnid-subaddr-odd

and you can set these to one of:
allowed_not_screened
allowed_passed_screen
allowed_failed_screen
allowed
prohib_not_screened
prohib_passed_screen
prohib_failed_screen
prohib
unavailable[/quote]

If the operator is objecting to unscreened, set num-pres to allowed_passed_screen

If they are objecting to the numbering plan, try different values of num-plan (I can’t work out exactly what is possible based on just a quick look).

Dear David,

Many thanks on the reply so quick again… I had added in one more line:

== Full dial out context ==

[macro-dialTrunk]
exten = s, 1, AGI(ehors/setCallerID.php)
exten = s, n, AGI(ehors/isExtensionActive.php)
;exten = s, n, SetCallerPres(allowed)
;exten = s, n, Set(CALLERID(all)="Palm Hotel" <0088>)
exten = s, n, Set(CALLERID(num-pres)=allowed_passed_screen)
exten = s, n, ExecIf($["${CALLERID(number)}" = "119"]?Set(CALLERID(all)="Charlie Test" <0019>):Set(CALLERID(all)="Palm Hotel" <0088>))
exten = s, n, Dial(${ARG2}/${ARG3}, ${ARG4})
exten = s, n, Goto(s-${DIALSTATUS}, 1)
exten = s-CHANUNAVAIL, 1, Playback(number-not-answering)
exten = s-CHANUNAVAIL, n, Congestion(60)
exten = s-NOANSWER, 1, Playback(number-not-answering)
exten = s-NOANSWER, n, Congestion(60)
exten = s-BUSY, 1, Playback(the-number-u-dialed&is-curntly-busy)
exten = s-BUSY, n, Congestion(60)
exten = s-., 1, Hangup

And pri debug show as follow, still cannot get xxxxx0019 only get the main line xxxxx0088…

server*CLI> pri set debug on span 1 Enabled debugging on span 1 server*CLI> server*CLI> == Using SIP RTP TOS bits 184 == Using SIP RTP CoS mark 5 -- Executing [90162290465@numberplan-office-lmni:1] Macro("SIP/119-00000002", "dialTrunk,SIP,DAHDI/g1,0162290465,60") in new stack -- Executing [s@macro-dialTrunk:1] AGI("SIP/119-00000002", "ehors/setCallerID.php") in new stack -- Launched AGI Script /var/lib/asterisk/agi-bin/ehors/setCallerID.php -- AGI Script Executing Application: (ResetCDR) Options: () -- <SIP/119-00000002>AGI Script ehors/setCallerID.php completed, returning 0 -- Executing [s@macro-dialTrunk:2] AGI("SIP/119-00000002", "ehors/isExtensionActive.php") in new stack -- Launched AGI Script /var/lib/asterisk/agi-bin/ehors/isExtensionActive.php -- <SIP/119-00000002>AGI Script ehors/isExtensionActive.php completed, returning 0 -- Executing [s@macro-dialTrunk:3] Set("SIP/119-00000002", "CALLERID(num-pres)=allowed_passed_screen") in new stack -- Executing [s@macro-dialTrunk:4] ExecIf("SIP/119-00000002", "1?Set(CALLERID(all)="Charlie Test" <0019>):Set(CALLERID(all)="Palm Hotel" <0088>)") in new stack -- Executing [s@macro-dialTrunk:5] Dial("SIP/119-00000002", "DAHDI/g1/0162290465, 60") in new stack PRI Span: 1 -- Making new call for cref 32771 -- Requested transfer capability: 0x00 - SPEECH PRI Span: 1 PRI Span: 1 > DL-DATA request PRI Span: 1 > Protocol Discriminator: Q.931 (8) len=36 PRI Span: 1 > TEI=0 Call Ref: len= 2 (reference 3/0x3) (Sent from originator) PRI Span: 1 > Message Type: SETUP (5) PRI Span: 1 TEI=0 Transmitting N(S)=0, window is open V(A)=0 K=7 PRI Span: 1 PRI Span: 1 > Protocol Discriminator: Q.931 (8) len=36 PRI Span: 1 > TEI=0 Call Ref: len= 2 (reference 3/0x3) (Sent from originator) PRI Span: 1 > Message Type: SETUP (5) PRI Span: 1 > [04 03 80 90 a3] PRI Span: 1 > Bearer Capability (len= 5) [ Ext: 1 Coding-Std: 0 Info transfer capability: Speech (0) PRI Span: 1 > Ext: 1 Trans mode/rate: 64kbps, circuit-mode (16) PRI Span: 1 > User information layer 1: A-Law (35) PRI Span: 1 > [18 03 a1 83 81] PRI Span: 1 > Channel ID (len= 5) [ Ext: 1 IntID: Implicit Other(PRI) Spare: 0 Preferred Dchan: 0 PRI Span: 1 > ChanSel: As indicated in following octets PRI Span: 1 > Ext: 1 Coding: 0 Number Specified Channel Type: 3 PRI Span: 1 > Ext: 1 Channel: 1 Type: CPE] PRI Span: 1 > [6c 06 41 81 30 30 31 39] PRI Span: 1 > Calling Party Number (len= 8) [ Ext: 0 TON: Subscriber Number (4) NPI: ISDN/Telephony Numbering Plan (E.164/E.163) (1) PRI Span: 1 > Presentation: Presentation allowed, User-provided, verified and passed (1) '0019' ] PRI Span: 1 > [70 0b 80 30 31 36 32 32 39 30 34 36 35] PRI Span: 1 > Called Party Number (len=13) [ Ext: 1 TON: Unknown Number Type (0) NPI: Unknown Number Plan (0) '0162290465' ] PRI Span: 1 q931.c:6291 q931_setup: Call 32771 enters state 1 (Call Initiated). Hold state: Idle -- Called DAHDI/g1/0162290465 PRI Span: 1 PRI Span: 1 < Protocol Discriminator: Q.931 (8) len=10 PRI Span: 1 < TEI=0 Call Ref: len= 2 (reference 3/0x3) (Sent to originator) PRI Span: 1 < Message Type: SETUP ACKNOWLEDGE (13) PRI Span: 1 < [18 03 a9 83 81] PRI Span: 1 < Channel ID (len= 5) [ Ext: 1 IntID: Implicit Other(PRI) Spare: 0 Exclusive Dchan: 0 PRI Span: 1 < ChanSel: As indicated in following octets PRI Span: 1 < Ext: 1 Coding: 0 Number Specified Channel Type: 3 PRI Span: 1 < Ext: 1 Channel: 1 Type: CPE] PRI Span: 1 Received message for call 0x2b07d80d31b0 on link 0x1603b7b0 TEI/SAPI 0/0 PRI Span: 1 -- Processing IE 24 (cs0, Channel ID) PRI Span: 1 q931.c:9141 post_handle_q931_message: Call 32771 enters state 2 (Overlap Sending). Hold state: Idle Span: 1 Processing event: PRI_EVENT_SETUP_ACK -- DAHDI/i1/0162290465-3 is making progress passing it to SIP/119-00000002 PRI Span: 1 PRI Span: 1 < Protocol Discriminator: Q.931 (8) len=10 PRI Span: 1 < TEI=0 Call Ref: len= 2 (reference 3/0x3) (Sent to originator) PRI Span: 1 < Message Type: CALL PROCEEDING (2) PRI Span: 1 < [18 03 a9 83 81] PRI Span: 1 < Channel ID (len= 5) [ Ext: 1 IntID: Implicit Other(PRI) Spare: 0 Exclusive Dchan: 0 PRI Span: 1 < ChanSel: As indicated in following octets PRI Span: 1 < Ext: 1 Coding: 0 Number Specified Channel Type: 3 PRI Span: 1 < Ext: 1 Channel: 1 Type: CPE] PRI Span: 1 Received message for call 0x2b07d80d31b0 on link 0x1603b7b0 TEI/SAPI 0/0 PRI Span: 1 -- Processing IE 24 (cs0, Channel ID) PRI Span: 1 q931.c:8776 post_handle_q931_message: Call 32771 enters state 3 (Outgoing Call Proceeding). Hold state: Idle Span: 1 Processing event: PRI_EVENT_PROCEEDING -- DAHDI/i1/0162290465-3 is proceeding passing it to SIP/119-00000002 [Jul 8 21:23:10] NOTICE[27702]: res_rtp_asterisk.c:2214 ast_rtp_read: Unknown RTP codec 126 received from '175.143.40.33:10309' PRI Span: 1 PRI Span: 1 < Protocol Discriminator: Q.931 (8) len=9 PRI Span: 1 < TEI=0 Call Ref: len= 2 (reference 3/0x3) (Sent to originator) PRI Span: 1 < Message Type: ALERTING (1) PRI Span: 1 < [1e 02 82 88] PRI Span: 1 < Progress Indicator (len= 4) [ Ext: 1 Coding: CCITT (ITU) standard (0) 0: 0 Location: Public network serving the local user (2) PRI Span: 1 < Ext: 1 Progress Description: Inband information or appropriate pattern now available. (8) ] PRI Span: 1 Received message for call 0x2b07d80d31b0 on link 0x1603b7b0 TEI/SAPI 0/0 PRI Span: 1 -- Processing IE 30 (cs0, Progress Indicator) PRI Span: 1 q931.c:8641 post_handle_q931_message: Call 32771 enters state 4 (Call Delivered). Hold state: Idle Span: 1 Processing event: PRI_EVENT_RINGING -- DAHDI/i1/0162290465-3 is ringing PRI Span: 1 q931.c:7092 q931_hangup: Hangup other cref:32771 PRI Span: 1 q931.c:6849 __q931_hangup: ourstate Call Delivered, peerstate Call Received, hold-state Idle PRI Span: 1 q931.c:6038 q931_disconnect: Call 32771 enters state 11 (Disconnect Request). Hold state: Idle PRI Span: 1 PRI Span: 1 > DL-DATA request PRI Span: 1 > Protocol Discriminator: Q.931 (8) len=9 PRI Span: 1 > TEI=0 Call Ref: len= 2 (reference 3/0x3) (Sent from originator) PRI Span: 1 > Message Type: DISCONNECT (69) PRI Span: 1 TEI=0 Transmitting N(S)=1, window is open V(A)=1 K=7 PRI Span: 1 PRI Span: 1 > Protocol Discriminator: Q.931 (8) len=9 PRI Span: 1 > TEI=0 Call Ref: len= 2 (reference 3/0x3) (Sent from originator) PRI Span: 1 > Message Type: DISCONNECT (69) PRI Span: 1 > [08 02 81 90] PRI Span: 1 > Cause (len= 4) [ Ext: 1 Coding: CCITT (ITU) standard (0) Spare: 0 Location: Private network serving the local user (1) PRI Span: 1 > Ext: 1 Cause: Normal Clearing (16), class = Normal Event (1) ] -- Hungup 'DAHDI/i1/0162290465-3' == Spawn extension (macro-dialTrunk, s, 5) exited non-zero on 'SIP/119-00000002' in macro 'dialTrunk' == Spawn extension (numberplan-office-lmni, 90162290465, 1) exited non-zero on 'SIP/119-00000002' PRI Span: 1 PRI Span: 1 < Protocol Discriminator: Q.931 (8) len=5 PRI Span: 1 < TEI=0 Call Ref: len= 2 (reference 3/0x3) (Sent to originator) PRI Span: 1 < Message Type: RELEASE (77) PRI Span: 1 Received message for call 0x2b07d80d31b0 on link 0x1603b7b0 TEI/SAPI 0/0 PRI Span: 1 q931.c:8942 post_handle_q931_message: Call 32771 enters state 0 (Null). Hold state: Idle Span: 1 Processing event: PRI_EVENT_HANGUP PRI Span: 1 q931.c:7092 q931_hangup: Hangup other cref:32771 PRI Span: 1 q931.c:6849 __q931_hangup: ourstate Null, peerstate Release Request, hold-state Idle PRI Span: 1 PRI Span: 1 > DL-DATA request PRI Span: 1 > Protocol Discriminator: Q.931 (8) len=9 PRI Span: 1 > TEI=0 Call Ref: len= 2 (reference 3/0x3) (Sent from originator) PRI Span: 1 > Message Type: RELEASE COMPLETE (90) PRI Span: 1 TEI=0 Transmitting N(S)=2, window is open V(A)=2 K=7 PRI Span: 1 PRI Span: 1 > Protocol Discriminator: Q.931 (8) len=9 PRI Span: 1 > TEI=0 Call Ref: len= 2 (reference 3/0x3) (Sent from originator) PRI Span: 1 > Message Type: RELEASE COMPLETE (90) PRI Span: 1 > [08 02 81 90] PRI Span: 1 > Cause (len= 4) [ Ext: 1 Coding: CCITT (ITU) standard (0) Spare: 0 Location: Private network serving the local user (1) PRI Span: 1 > Ext: 1 Cause: Normal Clearing (16), class = Normal Event (1) ] PRI Span: 1 q931.c:7092 q931_hangup: Hangup other cref:32771 PRI Span: 1 q931.c:6849 __q931_hangup: ourstate Null, peerstate Null, hold-state Idle PRI Span: 1 Destroying call 0x2b07d80d31b0, ourstate Null, peerstate Null, hold-state Idle

Then they may be objecting to the numbering plan.

Only they will know exactly what they will accept.

Hi, many thanks on your reply, my provider reply the following:

[quote]Could be the len=8,. Try set to 4. And try to use “Unknown Number”

PRI Span: 1 > [6c 06 41 81 30 30 31 39]
PRI Span: 1 > Calling Party Number (len= 8) [ Ext: 0 TON: Subscriber Number (4) NPI: ISDN/Telephony Numbering Plan (E.164/E.163) (1)
PRI Span: 1 > Presentation: Presentation allowed, User-provided, verified and passed (1) ‘0019’ ][/quote]

eh… Where do I set the length? Base on the hex code its a combinations of :

First 4 digits is acknowledge? Can it be taken out?

The length is determined by the size of the contents. The preceding octets are not ASCII; they will be coding things like the type of number. If you look at an incoming call, I think you will also find extra octets.

The format of this data is described in section 4.5.10 of the first document linked from itu.int/rec/T-REC-Q.931-199805-I/en

4 is impossible, as there is a type and length prefix. I think they are clutching at straws on the length, although I would take note that they also suggest changing the numbering plan. I haven’t used ISDN with Asterisk, so I don’t know what the coding of the numbering plan is, but I suspect you want 0.