# Receiving no Calling number via SIP Trunk

**URL:** <https://community.asterisk.org/t/receiving-no-calling-number-via-sip-trunk/77346>\
**Category:** Asterisk SIP\
**Created:** [November 27, 2018, 6:07pm UTC](https://community.asterisk.org/t/receiving-no-calling-number-via-sip-trunk/77346 "2018-11-27T18:07:54Z")\
**Posts on this page:** 17\
**Page:** 1

<div class="post-metadata">

**Author:** ![humber2](https://avatars.discourse-cdn.com/v4/letter/h/ecae2f/32.png) [@humber2](https://community.asterisk.org/u/humber2)\
**Post date:** [November 27, 2018, 6:07pm UTC](https://community.asterisk.org/t/receiving-no-calling-number-via-sip-trunk/77346/1 "2018-11-27T18:07:54Z")

</div>

```auto
We've a SIP Trunk and we're receiving 994X digits. The calls establish successfully, but the calling arrives in the destination as "unknown".

The result of the trace:

<--- SIP read from UDP:10.192.4.188:5060 --->
INVITE sip:9940@10.192.230.231:5060 SIP/2.0
Via: SIP/2.0/UDP 10.192.4.178;branch=z9hG4bK766a.5a652c6ff1dcbe13d2a9d2a59b38caf9.0
Via: SIP/2.0/UDP 192.168.111.250:5080;branch=z9hG4bK15fe7331;rport=5080
Max-Forwards: 69
From: "Rui Santos" <sip:1432@gt.ipphone.molde.pt>;tag=as261eb33b
To: <sip:9940@10.192.230.231:5060>
Contact: <sip:1432@10.192.4.178:5060>
Call-ID: 594384fc2fd8eeac4d61d52e4353f718@gt.ipphone.socem.pt
CSeq: 102 INVITE
User-Agent: IPBrick
Date: Tue, 27 Nov 2018 17:40:49 GMT
Allow: INVITE, ACK, CANCEL, OPTIONS, BYE, REFER, SUBSCRIBE, NOTIFY, INFO, PUBLISH
Supported: replaces, timer
P-Asserted-Identity: <sip:1432@10.192.230.231>
Content-Type: application/sdp
Content-Length: 247

```

In my extensions.conf:

exten =\> \_9XXX,1,Ringing()  
exten =\> \_9XXX,2,Dial({TRUNKSAGRES}/{EXTEN},180,tT)  
exten =\> \_9XXX,3,Hangup()

I’ve changed it without success to the following:

exten =\> \_9XXX,1,Ringing()  
exten =\> \_9XXX,2,Set(CALLERID(num)={SIP\_HEADER(P-Asserted-Identity)}) exten =\> \_9XXX,3,SipAddHeader(P-Asserted-Identity: {CALLERID(num)})  
exten =\> \_9XXX,4,Dial({TRUNKSAGRES}/{EXTEN},180,tT)  
exten =\> \_9XXX,5,Hangup()

I do not know what to do to pass the calling number … ☹

---

<div class="post-metadata">

**Author:** ![david551](https://avatars.discourse-cdn.com/v4/letter/d/3bc359/32.png) [@david551](https://community.asterisk.org/u/david551)\
**Post date:** [November 27, 2018, 6:15pm UTC](https://community.asterisk.org/t/receiving-no-calling-number-via-sip-trunk/77346/2 "2018-11-27T18:15:59Z")

</div>

Please do not try to manipulate this header directly. Simply use trustrpid=yes to have it read, and sendrpid=pai to have it written.

Also, please mark dialplan as preformatted text, on the forum.

---

<div class="post-metadata">

**Author:** ![humber2](https://avatars.discourse-cdn.com/v4/letter/h/ecae2f/32.png) [@humber2](https://community.asterisk.org/u/humber2)\
**Post date:** [November 28, 2018, 9:53am UTC](https://community.asterisk.org/t/receiving-no-calling-number-via-sip-trunk/77346/3 "2018-11-28T09:53:24Z")

</div>

```auto
[quote="david551, post:2, topic:77346"]
sendrpid=pai
[/quote]

Hi David, thanks for your reply. I didn't undestand very well your suggestion. I've tried the following:

Incoming Trunk:

[TRUNKSIP-MOLDES]
type=peer
host=10.192.4.178
context=incoming-moldes
disallow=all
allow = ulaw
dtmfmode=rfc2833
faxdetect=yes
t38pt_udptl=yes,redundancy,maxdatagram=400
canreinvite=no
qualify=8000
trustrpid=yes
sendrpid=yes
;sendrpid=pai
nat=no
deny=0.0.0.0/0.0.0.0
permit=10.192.4.178/255.255.255.255

Outgoing Trunk:

[TRUNKSIP-SAGRES]
type=peer
host=10.192.124.101
context=incoming-tlm
;disallow=all
allow = all
dtmfmode=inband
directmedia=no
qualify=yes
;sendrpid=pai 
sendrpid=yes
trust_id_outbound = yes
nat=no
deny=0.0.0.0/0.0.0.0
permit=10.192.124.101/255.255.255.255

And:

[TRUNKSIP-MOLDES]
type=peer
host=10.192.4.178
context=incoming-moldes
disallow=all
allow = ulaw
dtmfmode=rfc2833
faxdetect=yes
t38pt_udptl=yes,redundancy,maxdatagram=400
canreinvite=no
qualify=8000
trustrpid=yes
;sendrpid=yes
sendrpid=pai
nat=no
deny=0.0.0.0/0.0.0.0
permit=10.192.4.178/255.255.255.255

Outgoing Trunk:

[TRUNKSIP-SAGRES]
type=peer
host=10.192.124.101
context=incoming-tlm
;disallow=all
allow = all
dtmfmode=inband
directmedia=no
qualify=yes
;sendrpid=pai 
sendrpid=yes
trust_id_outbound = yes
nat=no
deny=0.0.0.0/0.0.0.0
permit=10.192.124.101/255.255.255.255

In both cases the call didn't went to the outgoing trunk and the caller gets the following information in his VoIP Terminal -> 403 - forbidden.

Which configuration shoud I have please?

The versions of Asterisks are 13.10.

```

---

<div class="post-metadata">

**Author:** ![humber2](https://avatars.discourse-cdn.com/v4/letter/h/ecae2f/32.png) [@humber2](https://community.asterisk.org/u/humber2)\
**Post date:** [November 28, 2018, 10:22am UTC](https://community.asterisk.org/t/receiving-no-calling-number-via-sip-trunk/77346/4 "2018-11-28T10:22:42Z")

</div>

```auto
Even with the following configuration, the result is the same:

Incoming Trunk:

[TRUNKSIP-MOLDES]
type=peer
host=10.192.4.178
context=incoming-moldes
disallow=all
allow = ulaw
dtmfmode=rfc2833
faxdetect=yes
t38pt_udptl=yes,redundancy,maxdatagram=400
canreinvite=no
qualify=8000
nat=no
deny=0.0.0.0/0.0.0.0
permit=10.192.4.178/255.255.255.255

Outgoing Trunk:

[TRUNKSIP-SAGRES]
type=peer
host=10.192.124.101
context=incoming-tlm
;disallow=all
allow = all
dtmfmode=inband
directmedia=no
qualify=yes
sendrpid=pai 
trustrpid=yes
nat=no
deny=0.0.0.0/0.0.0.0
permit=10.192.124.101/255.255.255.255

 It appear 403 forbidden in the terminal of the caller and it didn't went to outgoing trunk (Sagres). The error i logging: 

-- Executing [9942@incoming-moldes:1] Ringing("SIP/TRUNKSIP-MOLDES-000002b3", "") in new stack
    -- Auto fallthrough, channel 'SIP/TRUNKSIP-MOLDES-000002b3' status is 'UNKNOWN'
  == Using SIP RTP CoS mark

```

5

---

<div class="post-metadata">

**Author:** ![humber2](https://avatars.discourse-cdn.com/v4/letter/h/ecae2f/32.png) [@humber2](https://community.asterisk.org/u/humber2)\
**Post date:** [November 28, 2018, 10:41am UTC](https://community.asterisk.org/t/receiving-no-calling-number-via-sip-trunk/77346/5 "2018-11-28T10:41:30Z")

</div>

And this what We get from the client in our Asterisk:

```auto

<--- SIP read from UDP:10.192.4.178:5060 --->
INVITE sip:9940@10.192.230.231:5060 SIP/2.0
Via: SIP/2.0/UDP 10.192.4.178;branch=z9hG4bK766a.5a652c6ff1dcbe13d2a9d2a59b38caf9.0
Via: SIP/2.0/UDP 192.168.111.250:5080;branch=z9hG4bK15fe7331;rport=5080
Max-Forwards: 69
From: "Rui Santos" <sip:1432@gt.ipphone.moldes.pt>;tag=as261eb33b
To: <sip:9940@10.192.230.231:5060>
Contact: <sip:1432@10.192.4.178:5060>
Call-ID: 594384fc2fd8eeac4d61d52e4353f718@gt.ipphone.socem.pt
CSeq: 102 INVITE
User-Agent: IPBrick
Date: Tue, 27 Nov 2018 17:40:49 GMT
Allow: INVITE, ACK, CANCEL, OPTIONS, BYE, REFER, SUBSCRIBE, NOTIFY, INFO, PUBLISH
Supported: replaces, timer
P-Asserted-Identity: <sip:1432@10.192.230.231>
Content-Type: application/sdp
Content-Length: 247

```

---

<div class="post-metadata">

**Author:** ![humber2](https://avatars.discourse-cdn.com/v4/letter/h/ecae2f/32.png) [@humber2](https://community.asterisk.org/u/humber2)\
**Post date:** [November 28, 2018, 10:42am UTC](https://community.asterisk.org/t/receiving-no-calling-number-via-sip-trunk/77346/6 "2018-11-28T10:42:40Z")

</div>

`The goal is to send 1432 to the outgoing SIP trunk (Sagres).`

---

<div class="post-metadata">

**Author:** ![david551](https://avatars.discourse-cdn.com/v4/letter/d/3bc359/32.png) [@david551](https://community.asterisk.org/u/david551)\
**Post date:** [November 28, 2018, 11:13am UTC](https://community.asterisk.org/t/receiving-no-calling-number-via-sip-trunk/77346/7 "2018-11-28T11:13:57Z")

</div>

> [@humber2](#):
>
> And this what We get from the client in our Asterisk:

That’s what you are now doing… If the other end of the trunk doesn’t honour this you need to talk to the people that maintain that.

I am assuming that both trunks actually use P-Asserted-Identity.

Note these look like tie trunks, but trunks to the PSTN would not normally honour caller-ID, unless, possibly you had proved you controlled the number in use.

Also, please note that canreinvite has been deprecated since about Asterisk 6.

---

<div class="post-metadata">

**Author:** ![humber2](https://avatars.discourse-cdn.com/v4/letter/h/ecae2f/32.png) [@humber2](https://community.asterisk.org/u/humber2)\
**Post date:** [November 28, 2018, 11:21am UTC](https://community.asterisk.org/t/receiving-no-calling-number-via-sip-trunk/77346/8 "2018-11-28T11:21:20Z")

</div>

```auto
We've a SIP Trunk with a Client (IPPbrick), and the call comes from the incoming Trunk referred above (Moldes), and then our Asterisk must route that call to another Asterisk (mine) via outgoing Trunk (Sagres). So what Can I must do please? (sorry I didn't understand your explanation)

And if canreinvite is deprecated I can suppress both lines in both trunks right?

```

---

<div class="post-metadata">

**Author:** ![humber2](https://avatars.discourse-cdn.com/v4/letter/h/ecae2f/32.png) [@humber2](https://community.asterisk.org/u/humber2)\
**Post date:** [November 28, 2018, 11:24am UTC](https://community.asterisk.org/t/receiving-no-calling-number-via-sip-trunk/77346/9 "2018-11-28T11:24:50Z")

</div>

And if the client is sending the caller ID correctly as shown below why Our Asterisk doesn’t forward that Caller ID information to my another Asterisk?

From: “Rui Santos” \<sip:1432@gt.ipphone.moldes.pt\>;tag=as261eb33b To: \<sip:9940@10.192.230.231:5060\>  
[/quote]

```auto

```

---

<div class="post-metadata">

**Author:** ![humber2](https://avatars.discourse-cdn.com/v4/letter/h/ecae2f/32.png) [@humber2](https://community.asterisk.org/u/humber2)\
**Post date:** [November 28, 2018, 11:47am UTC](https://community.asterisk.org/t/receiving-no-calling-number-via-sip-trunk/77346/10 "2018-11-28T11:47:53Z")

</div>

```auto
Now, in my Asterisk Viriato I've:

Incoming Trunk to Cliente (IPBrick PBX)

[TRUNKSIP-MOLDES]
type=peer
host=10.192.4.178
context=incoming-socem
disallow=all
allow = ulaw
dtmfmode=rfc2833
faxdetect=yes
t38pt_udptl=yes,redundancy,maxdatagram=400
canreinvite=no
qualify=yes
;trustrpid=yes
;sendrpid=yes
;sendrpid=pai
nat=no
deny=0.0.0.0/0.0.0.0
permit=10.192.4.178/255.255.255.255

Outgoing Trunk to My Asterisk Sagres:

[TRUNKSIP-SAGRES]
type=peer
host=10.192.124.101
context=incoming-tlm
;disallow=all
allow = all
dtmfmode=inband
directmedia=no
qualify=yes
trustrpid=yes
;sendrpid=yes
sendrpid=pai
nat=no
deny=0.0.0.0/0.0.0.0
permit=10.192.124.101/255.255.255.255

And in My Asterisk Sagres:

[TRUNKSIP-VIRIATO]
type=peer
host=10.192.230.231
context=and_int
;disallow=all
allow = all
dtmfmode=inband
directmedia=no
qualify=yes
nat=comedia
trustrpid=yes
sendrpid=pai
deny=0.0.0.0/0.0.0.0
permit=10.192.230.231/255.255.255.255

What we get in Asterisk Viriato:

 Executing [9942@incoming-socem:1] Ringing("SIP/TRUNKSIP-SOCEM-00000483", "") in new stack
    -- Auto fallthrough, channel 'SIP/TRUNKSIP-SOCEM-00000483' status is 'UNKNOWN'

```

---

<div class="post-metadata">

**Author:** ![humber2](https://avatars.discourse-cdn.com/v4/letter/h/ecae2f/32.png) [@humber2](https://community.asterisk.org/u/humber2)\
**Post date:** [November 28, 2018, 11:49am UTC](https://community.asterisk.org/t/receiving-no-calling-number-via-sip-trunk/77346/11 "2018-11-28T11:49:36Z")

</div>

`In Sagres Asterisk we got nothing.`

---

<div class="post-metadata">

**Author:** ![david551](https://avatars.discourse-cdn.com/v4/letter/d/3bc359/32.png) [@david551](https://community.asterisk.org/u/david551)\
**Post date:** [November 28, 2018, 12:10pm UTC](https://community.asterisk.org/t/receiving-no-calling-number-via-sip-trunk/77346/12 "2018-11-28T12:10:44Z")

</div>

Sorry, I thought you had actually provided the outgoing SIP request, as well. You need to do that. You need to provide the full text, not just a few lines, as the From header can be influenced by

Please note that Asterisk has no concept of trunks and certainly no concept of outgoing an incoming trunks, so, if you have two sip.conf entries for the same peer, you may find that incoming calls are actually matched to the one you consider outgoing.

Also please note that full support for PAI started in Asterisk 1.8, so if you are using an obsolete version, sendrpid and trustrpid may not work as expected.

canreinvite is not relevant to your problem, and saying it was deprecated was a hint to read the documentation. It has been replaced by directmedia. Currently canreinvite is treated as an alternative name for directmedia, but is a good indication that someone has cut and pasted a configuration without understanding it.

---

<div class="post-metadata">

**Author:** ![jcolp](https://sea1.discourse-cdn.com/asterisk/user_avatar/community.asterisk.org/jcolp/32/8848_2.png) [@jcolp](https://community.asterisk.org/u/jcolp)\
**Post date:** [November 28, 2018, 12:13pm UTC](https://community.asterisk.org/t/receiving-no-calling-number-via-sip-trunk/77346/13 "2018-11-28T12:13:37Z")

</div>

I would also suggest providing the current dialplan logic for that particular context again, because it seems as though it is incorrect and the channel is falling through and hanging up.

---

<div class="post-metadata">

**Author:** ![david551](https://avatars.discourse-cdn.com/v4/letter/d/3bc359/32.png) [@david551](https://community.asterisk.org/u/david551)\
**Post date:** [November 28, 2018, 12:15pm UTC](https://community.asterisk.org/t/receiving-no-calling-number-via-sip-trunk/77346/14 "2018-11-28T12:15:47Z")

</div>

And please mark everything quoted as pre-formatted, as missing characters and lines run together make it difficult to read.

---

<div class="post-metadata">

**Author:** ![humber2](https://avatars.discourse-cdn.com/v4/letter/h/ecae2f/32.png) [@humber2](https://community.asterisk.org/u/humber2)\
**Post date:** [November 28, 2018, 12:26pm UTC](https://community.asterisk.org/t/receiving-no-calling-number-via-sip-trunk/77346/15 "2018-11-28T12:26:30Z")

</div>

```auto
I've fixed the dialplan. Thanks jcolp!

I've maintained the configuration of SIP.conf files of my Asterisks (Viriato and Sagres) as referred above. The problem still remains. The destination doesn't see 1432 but "Unknown"...

The trace received in Viriato:

<--- SIP read from UDP:10.192.4.178:5060 --->
INVITE sip:9940@10.192.230.231:5060 SIP/2.0
Via: SIP/2.0/UDP 10.192.4.178;branch=z9hG4bK766a.5a652c6ff1dcbe13d2a9d2a59b38caf9.0
Via: SIP/2.0/UDP 192.168.111.250:5080;branch=z9hG4bK15fe7331;rport=5080
Max-Forwards: 69
From: "Rui Santos" <sip:1432@gt.ipphone.socem.pt>;tag=as261eb33b
To: <sip:9940@10.192.230.231:5060>
Contact: <sip:1432@10.192.4.178:5060>
Call-ID: 594384fc2fd8eeac4d61d52e4353f718@gt.ipphone.socem.pt
CSeq: 102 INVITE
User-Agent: IPBrick
Date: Tue, 27 Nov 2018 17:40:49 GMT
Allow: INVITE, ACK, CANCEL, OPTIONS, BYE, REFER, SUBSCRIBE, NOTIFY, INFO, PUBLISH
Supported: replaces, timer
P-Asserted-Identity: <sip:1432@10.192.230.231>
Content-Type: application/sdp
Content-Length: 247

```

And now? (Asterisk Version 13.10 for both)

Regarding formatting text I’m selecting all the text and then select \</\> Isn’t it the right procedure?

---

<div class="post-metadata">

**Author:** ![david551](https://avatars.discourse-cdn.com/v4/letter/d/3bc359/32.png) [@david551](https://community.asterisk.org/u/david551)\
**Post date:** [November 28, 2018, 12:40pm UTC](https://community.asterisk.org/t/receiving-no-calling-number-via-sip-trunk/77346/16 "2018-11-28T12:40:19Z")

</div>

You still haven’t provided the complete outgoing request, and you did not use \</\> on the partial quote that you provided earlier.

---

<div class="post-metadata">

**Author:** ![humber2](https://avatars.discourse-cdn.com/v4/letter/h/ecae2f/32.png) [@humber2](https://community.asterisk.org/u/humber2)\
**Post date:** [November 28, 2018, 1:02pm UTC](https://community.asterisk.org/t/receiving-no-calling-number-via-sip-trunk/77346/17 "2018-11-28T13:02:19Z")

</div>

````auto
David,

The integral SIP trace obtained from the Asterisk Viriato (Calling 1431 and Called 9941) and in Sagres Asterisk attached.
```<a class="attachment" href="/uploads/default/original/2X/f/f0589ff0a4d2343144c4b86b023c18b10e152946.txt">Trace_moldes_Sagres.txt</a> (70.8 KB)
 <a class="attachment" href="/uploads/default/original/2X/6/67aea4cc62226846b9866d7539cc664e99508b5a.txt">Trace_Modes_Viriato.txt</a> (77.4 KB)
````
