How change the CallerID when you make external calls?

The application accepts an extension and immediately jumps to it. Which is what is happening. If you want to take in some DTMF digits and put them in a variable for use then Read[1] would be the one to use. I agree with @david551 though, you are lacking very fundamental dialplan basics and not having a solid foundation will cause you to run into more and more problems. You should read some more and start basic and try to understand what is going on.

[1] https://wiki.asterisk.org/wiki/display/AST/Asterisk+13+Application_Read

Like I said before, Iā€™m actually reading some books about it. As Practical Asterisk 1.4 and 1.6: From Beginner to Expert, I canā€™t known all the applications and functions in Asterisk because Iā€™m a Rookie guy for the momentā€¦ :smile:

Assuming your provider lets you set the caller ID to any of your assigned numbers I gave a example two weeks ago for selecting the number to dial as by defining prefixes.

If you dial *1 the call would go out provider 1 with the caller ID of 5205551111
If you dial *2 the call would go out provider 1 with the caller ID of 5205552222
etc.

exten => *1X!,1,Set(CALLERID(NUM)=5205551111)
 same => n,Dial(PJSIP/${EXTEN:2}@provider1)

exten => *2X!,1,Set(CALLERID(NUM)=5205552222)
 same => n,Dial(PJSIP/${EXTEN:2}@provider1)

exten => *3X!,1,Set(CALLERID(NUM)=5205553333)
 same => n,Dial(PJSIP/${EXTEN:2}@provider2)

Hi @everyone,

Now Iā€™m going to my context [outgoing-selfone-voip] but he hangup and I can catch my destination.

This is what I have in my CLI Asterisk:

Connected to Asterisk 13.20.0 currently running on IPBX-Asterisk (pid = 2023)
  == Setting global variable 'SIPDOMAIN' to '192.168.40.55'
    -- Executing [300@from-internal:1] NoOp("PJSIP/103-00000002", "## Outgoing Call from Selfone ##") in new stack
    -- Executing [300@from-internal:2] NoOp("PJSIP/103-00000002", "## Your CallerID is : "Arnold" <103> for 300 ##") in new stack
    -- Executing [300@from-internal:3] Set("PJSIP/103-00000002", "CALLERID(num)=028085449") in new stack
    -- Executing [300@from-internal:4] GotoIf("PJSIP/103-00000002", "BXL_IN1=028085449?selfone:end") in new stack
    -- Goto (from-internal,300,5)
    -- Executing [300@from-internal:5] Playback("PJSIP/103-00000002", "enter-ext-of-person") in new stack
    -- <PJSIP/103-00000002> Playing 'enter-ext-of-person.ulaw' (language 'fr')
    -- Executing [300@from-internal:6] Read("PJSIP/103-00000002", "NUMBER,,10,3") in new stack
    -- Accepting a maximum of 10 digits.
    -- User entered '042680871'
    -- Executing [300@from-internal:7] Playback("PJSIP/103-00000002", "you-entered") in new stack
    -- <PJSIP/103-00000002> Playing 'you-entered.ulaw' (language 'fr')
    -- Executing [300@from-internal:8] SayDigits("PJSIP/103-00000002", "042680871") in new stack
    -- <PJSIP/103-00000002> Playing 'digits/0.ulaw' (language 'fr')
    -- <PJSIP/103-00000002> Playing 'digits/4.ulaw' (language 'fr')
    -- <PJSIP/103-00000002> Playing 'digits/2.ulaw' (language 'fr')
    -- <PJSIP/103-00000002> Playing 'digits/6.ulaw' (language 'fr')
    -- <PJSIP/103-00000002> Playing 'digits/8.ulaw' (language 'fr')
    -- <PJSIP/103-00000002> Playing 'digits/0.ulaw' (language 'fr')
    -- <PJSIP/103-00000002> Playing 'digits/8.ulaw' (language 'fr')
    -- <PJSIP/103-00000002> Playing 'digits/7.ulaw' (language 'fr')
    -- <PJSIP/103-00000002> Playing 'digits/1.ulaw' (language 'fr')
    -- Executing [300@from-internal:9] Goto("PJSIP/103-00000002", "outgoing-selfone-voip,042680871,1") in new stack
    -- Goto (outgoing-selfone-voip,042680871,1)
    -- Executing [042680871@outgoing-selfone-voip:1] NoOp("PJSIP/103-00000002", "Selfone : Outbound Call to the 042680871") in new stack
    -- Executing [042680871@outgoing-selfone-voip:2] Dial("PJSIP/103-00000002", "PJSIP/042680871@selfone-voip") in new stack
    -- Called PJSIP/042680871@selfone-voip
  == Everyone is busy/congested at this time (1:0/0/1)
    -- Executing [042680871@outgoing-selfone-voip:3] Hangup("PJSIP/103-00000002", "") in new stack
  == Spawn extension (outgoing-selfone-voip, 042680871, 3) exited non-zero on 'PJSIP/103-00000002'

Do you think is my codecs ? Or something else ?

You havenā€™t provided sufficient logging to see why the channel is being considered unavailable. You probably need to include protocol logging.

<--- Received SIP request (470 bytes) from UDP:192.168.40.50:53767 --->
ACK sip:192.168.40.55:5060 SIP/2.0
Via: SIP/2.0/UDP 192.168.40.50:53767;branch=z9hG4bK-524287-1---18306946e2d6e35e;rport
Max-Forwards: 70
Contact: <sip:103@192.168.40.50:53767;rinstance=037602c767835354>
To: <sip:300@192.168.40.55>;tag=bfc61c9b-23d0-4b7e-a08e-c471cf029606
From: "Arnold" <sip:103@192.168.40.55>;tag=abf3bc01
Call-ID: 90534OTBkZDFlNjI5NDJhMGYwMmQyNzdkZjMzZDNlMGVkMjc
CSeq: 2 ACK
User-Agent: X-Lite release 5.2.0 stamp 90534
Content-Length: 0


    -- <PJSIP/103-0000000e> Playing 'enter-ext-of-person.ulaw' (language 'fr')
    -- Executing [300@from-internal:6] Read("PJSIP/103-0000000e", "NUMBER,,10,3") in new stack
    -- Accepting a maximum of 10 digits.
    -- User entered '042680871'
    -- Executing [300@from-internal:7] Playback("PJSIP/103-0000000e", "you-entered") in new stack
    -- <PJSIP/103-0000000e> Playing 'you-entered.ulaw' (language 'fr')
    -- Executing [300@from-internal:8] SayDigits("PJSIP/103-0000000e", "042680871") in new stack
    -- <PJSIP/103-0000000e> Playing 'digits/0.ulaw' (language 'fr')
    -- <PJSIP/103-0000000e> Playing 'digits/4.ulaw' (language 'fr')
    -- <PJSIP/103-0000000e> Playing 'digits/2.ulaw' (language 'fr')
    -- <PJSIP/103-0000000e> Playing 'digits/6.ulaw' (language 'fr')
    -- <PJSIP/103-0000000e> Playing 'digits/8.ulaw' (language 'fr')
    -- <PJSIP/103-0000000e> Playing 'digits/0.ulaw' (language 'fr')
    -- <PJSIP/103-0000000e> Playing 'digits/8.ulaw' (language 'fr')
    -- <PJSIP/103-0000000e> Playing 'digits/7.ulaw' (language 'fr')
    -- <PJSIP/103-0000000e> Playing 'digits/1.ulaw' (language 'fr')
    -- Executing [300@from-internal:9] Goto("PJSIP/103-0000000e", "outgoing-selfone-voip,042680871,1") in new stack
    -- Goto (outgoing-selfone-voip,042680871,1)
    -- Executing [042680871@outgoing-selfone-voip:1] NoOp("PJSIP/103-0000000e", "Selfone : Outbound Call to the 042680871") in new stack
    -- Executing [042680871@outgoing-selfone-voip:2] Ringing("PJSIP/103-0000000e", "") in new stack
    -- Executing [042680871@outgoing-selfone-voip:3] Dial("PJSIP/103-0000000e", "PJSIP/042680871@selfone-voip") in new stack

<--- Transmitting SIP request (996 bytes) to UDP:<ip public>:5060 --->
INVITE sip:042680871@sip.cmrp.net:5060 SIP/2.0
Via: SIP/2.0/UDP <ip public>:5060;rport;branch=z9hG4bKPj0c3bc375-f75e-4e6f-a9ed-710ae966ac1c
From: <sip:71039127@sip.cmrp.net>;tag=64cc2bea-f084-4453-9bdf-2efffb8c20a7
To: <sip:042680871@sip.cmrp.net>
Contact: <sip:71039127@41.82.69.242:5060>
Call-ID: 2f05030d-3205-40f9-a9d1-777fd2d3f462
CSeq: 2707 INVITE
Allow: OPTIONS, SUBSCRIBE, NOTIFY, PUBLISH, INVITE, ACK, BYE, CANCEL, UPDATE, PRACK, REGISTER, MESSAGE, REFER
Supported: 100rel, timer, replaces, norefersub
Session-Expires: 1800
Min-SE: 90
Max-Forwards: 70
User-Agent: Asterisk PBX 13.20.0
Content-Type: application/sdp
Content-Length:   332

v=0
o=- 1677197234 1677197234 IN IP4 <ip public>
s=Asterisk
c=IN IP4 <ip public>
t=0 0
m=audio 14892 RTP/AVP 0 8 9 18 101
a=rtpmap:0 PCMU/8000
a=rtpmap:8 PCMA/8000
a=rtpmap:9 G722/8000
a=rtpmap:18 G729/8000
a=fmtp:18 annexb=no
a=rtpmap:101 telephone-event/8000
a=fmtp:101 0-16
a=ptime:20
a=maxptime:150
a=sendrecv

    -- Called PJSIP/042680871@selfone-voip

<--- Received SIP response (572 bytes) from UDP:<ip public>:5060 --->
SIP/2.0 401 Unauthorized
Via: SIP/2.0/UDP <ip public>:5060;branch=z9hG4bKPj0c3bc375-f75e-4e6f-a9ed-710ae966ac1c;received=<ip public>;rport=41348
From: <sip:71039127@sip.cmrp.net>;tag=64cc2bea-f084-4453-9bdf-2efffb8c20a7
To: <sip:042680871@sip.cmrp.net>;tag=as3aa57473
Call-ID: 2f05030d-3205-40f9-a9d1-777fd2d3f462
CSeq: 2707 INVITE
Server: Asterisk PBX 1.6.2.24
Allow: INVITE, ACK, CANCEL, OPTIONS, BYE, REFER, SUBSCRIBE, NOTIFY, INFO
Supported: replaces, timer
WWW-Authenticate: Digest algorithm=MD5, realm="ultimcore", nonce="6d19be10"
Content-Length: 0


<--- Transmitting SIP request (402 bytes) to UDP:<ip public>:5060 --->
ACK sip:042680871@sip.cmrp.net:5060 SIP/2.0
Via: SIP/2.0/UDP <ip public>:5060;rport;branch=z9hG4bKPj0c3bc375-f75e-4e6f-a9ed-710ae966ac1c
From: <sip:71039127@sip.cmrp.net>;tag=64cc2bea-f084-4453-9bdf-2efffb8c20a7
To: <sip:042680871@sip.cmrp.net>;tag=as3aa57473
Call-ID: 2f05030d-3205-40f9-a9d1-777fd2d3f462
CSeq: 2707 ACK
Max-Forwards: 70
User-Agent: Asterisk PBX 13.20.0
Content-Length:  0


<--- Transmitting SIP request (1175 bytes) to UDP:<ip public>:5060 --->
INVITE sip:042680871@sip.cmrp.net:5060 SIP/2.0
Via: SIP/2.0/UDP <ip public>:5060;rport;branch=z9hG4bKPjd1fb9c22-3148-44f6-993e-bd2726829635
From: <sip:71039127@sip.cmrp.net>;tag=64cc2bea-f084-4453-9bdf-2efffb8c20a7
To: <sip:042680871@sip.cmrp.net>
Contact: <sip:71039127@<ip public>:5060>
Call-ID: 2f05030d-3205-40f9-a9d1-777fd2d3f462
CSeq: 2708 INVITE
Allow: OPTIONS, SUBSCRIBE, NOTIFY, PUBLISH, INVITE, ACK, BYE, CANCEL, UPDATE, PRACK, REGISTER, MESSAGE, REFER
Supported: 100rel, timer, replaces, norefersub
Session-Expires: 1800
Min-SE: 90
Max-Forwards: 70
User-Agent: Asterisk PBX 13.20.0
Authorization: Digest username="71039127", realm="ultimcore", nonce="6d19be10", uri="sip:042680871@sip.cmrp.net:5060", response="c8d26b90d04d46337c0a1bbb95e4d650", algorithm=MD5
Content-Type: application/sdp
Content-Length:   332

v=0
o=- 1677197234 1677197234 IN IP4 <ip public>
s=Asterisk
c=IN IP4 <ip public>
t=0 0
m=audio 14892 RTP/AVP 0 8 9 18 101
a=rtpmap:0 PCMU/8000
a=rtpmap:8 PCMA/8000
a=rtpmap:9 G722/8000
a=rtpmap:18 G729/8000
a=fmtp:18 annexb=no
a=rtpmap:101 telephone-event/8000
a=fmtp:101 0-16
a=ptime:20
a=maxptime:150
a=sendrecv

<--- Received SIP response (492 bytes) from UDP:<ip public>:5060 --->
SIP/2.0 404 Not Found
Via: SIP/2.0/UDP <ip public>:5060;branch=z9hG4bKPjd1fb9c22-3148-44f6-993e-bd2726829635;received=<ip public>;rport=41348
From: <sip:71039127@sip.cmrp.net>;tag=64cc2bea-f084-4453-9bdf-2efffb8c20a7
To: <sip:042680871@sip.cmrp.net>;tag=as3aa57473
Call-ID: 2f05030d-3205-40f9-a9d1-777fd2d3f462
CSeq: 2708 INVITE
Server: Asterisk PBX 1.6.2.24
Allow: INVITE, ACK, CANCEL, OPTIONS, BYE, REFER, SUBSCRIBE, NOTIFY, INFO
Supported: replaces, timer
Content-Length: 0


<--- Transmitting SIP request (402 bytes) to UDP:<Ip Public>:5060 --->
ACK sip:042680871@sip.cmrp.net:5060 SIP/2.0
Via: SIP/2.0/UDP <ip public>:5060;rport;branch=z9hG4bKPjd1fb9c22-3148-44f6-993e-bd2726829635
From: <sip:71039127@sip.cmrp.net>;tag=64cc2bea-f084-4453-9bdf-2efffb8c20a7
To: <sip:042680871@sip.cmrp.net>;tag=as3aa57473
Call-ID: 2f05030d-3205-40f9-a9d1-777fd2d3f462
CSeq: 2708 ACK
Max-Forwards: 70
User-Agent: Asterisk PBX 13.20.0
Content-Length:  0


  == Everyone is busy/congested at this time (1:0/0/1)
    -- Executing [042680871@outgoing-selfone-voip:4] Hangup("PJSIP/103-0000000e", "") in new stack
  == Spawn extension (outgoing-selfone-voip, 042680871, 4) exited non-zero on 'PJSIP/103-0000000e'

You tried to call a number that does not exist.

How ? I typing this number 042680871 and he exist. Itā€™s the number of our secretary. :grinning:

You will need to ask cmrp.net that. That is the number you presented to them, but they have clearly responded that it does not exist:

Actually I can receive some calls and calls others persons. But when I want to display an other number,
at this moment Itā€™s always the same number given by my provider who is display on my mobile.
Do you think, itā€™s because my provider have not accept any changement of the number what is given for inbound and outbound calls ? Or itā€™s because I use a PJSIP trunk ?

It is most likely that this is because your provider doesnā€™t allow you to do it, as an anti-phone spam measure.

It is possible that you are sending a caller presentation status that forbids presentation or is otherwise unacceptable to your provider. It is also possible that the provider does not accept national number as the format for caller ID, at least wit the default type of number. Type of number and presentation restrictions can only be signalled if you are sending RPID or PAI headers.

Many providers will allow you to present specific numbers once you have proved to them that those numbers are under your control.

By default in PJSIP Configuration for the endpoint; the options below are to No :

send_pai (Send the P-Asserted-Identity header)
send_rpid (Send the Remote-Party-ID header)
trust_id_inbound (Accept identification information received from this endpoint.)
trust_id_outbound (Send private identification details to the endpoint.)

And when I make a call, my mobile phone display ā€œhidden numberā€ or ā€œunknown numberā€

pjsip.conf

[belgium-voip]
type=endpoint
context=from-belgium-voip
dtmf_mode=rfc4733
rtp_symmetric=yes
rewrite_contact=yes
send_pai=no
send_rpid=no
from_domain=voip.belgium-voip.com
outbound_auth=belgium-voip-auth
aors=belgium-voip
allow=alaw,ulaw,gsm,g722,g729

exetnsions.conf

[globals]
;incoming number defintion
BXL_IN1 = 02808XXXX

[from-internal]
;============================= CallerID 02 808 XX XX ============================
exten => _301,1,NoOp(## Outgoing Call from BelgiumVoIP ##)
 same => n,NoOp(## Your CallerID is : ${CALLERID(all)} for ${EXTEN} ##)
 same =>n,Set(CALLERID(num)=${BXL_IN1})
 same => n,Playback(privacy-your-callerid-is)
 same => n,SayDigits(${CALLERID(num)})
 same => n,GotoIf(${BXL_IN1}=${CALLERID(num)}?BelgiumVoIP:end)
 same => n(BelgiumVoIP),Playback(enter-ext-of-person)
 same => n,Read(NUMBER,,20,3)
 same => n,Playback(you-entered)
 same => n,SayDigits(${NUMBER})
 same => n,Goto(outgoing-calls,${NUMBER},1)
 same => n(end),Hangup()

How does Belgium Telecom require you to send caller ID data, assuming that they allow you to send it at all?

1 Like

Actually, I donā€™t know how BelgiumVoIP work with the other telecom operators in particular those of Belgium.

Itā€™s how they work with SIP customers, not how they work with other operators.

Yes, the provider has to allow you to change your caller ID. To prevent fraud most only allow caller IDā€™s they provide to be sent.

So, I must to provide to my provider all the numbers with which I want to out my different calls.

First you need to find out whether the provide will allow you to override the caller ID at all.

Then you need to find out how they expect you to send caller ID.

If they do allow you to override, they will then probably go through a process where they ring each number you have provided and ask them to confirm that you are permitted to present that number.

Ok, alright :slight_smile:

Yes, Itā€™s my provider who must authorise the changement of Caller ID. He made it, and now all work wellā€¦

1 Like