Inbound calls not working and DID number replaced

Hi,

I am new to asterisk so my mistake may be simple. Outbound calls work fine from a sip phone, but inbound calls do not.
My incoming mobile number gets replaced by a strange number and the error ‘Endpoint not found for from username <(strange number)> domain 172.30.XX.XX.’ and in the recieved SIP request it says from:<sip:(strange number).> does anyone know the reason a number would be replaced?

Thanks

Ask your service provider, or at least provide the SIP or PJSIP protocol logs.

dial plan sample and log output for a start

(the phone i am trying to reach is extension 510)

extensions.conf

[phones]

`

exten => 510,1,Dial(PJSIP/510)`
exten =>_0.,1,Dial(PJSIP/voice_out/sip${EXTEN}@sip.XX.XX.com:5060,,r(ringcadence))

[voice_in]
exten => _X.,1,NoOp()
exten => _X.,n,NoOp(${CUT(CUT(PJSIP_HEADER(read,To),@,1),:,2)})
exten => _X.,1,Goto(from-trunk,${CUT(CUT(PJSIP_HEADER(read,To),@,1),:,2)},1)

[from-trunk]

exten => _X.,n,Dial(PJSIP/510)

[from-ip]
exten => _X.,1,Progress()
exten => _X.,n,Dial(SIP/510)

Log output 
[Jun 16 10:43:34] DEBUG[26345]: res_pjsip_endpoint_identifier_ip.c:197 ip_identify_match_check: Source address XX.XX.XX.XX:5060 does not match identify 'voice_in'
[Jun 16 10:43:34] DEBUG[26345]: res_pjsip_endpoint_identifier_ip.c:222 ip_identify: Identify checks by IP address failed to find match: 'XX.XX.XX.XX:5060' did not match any identify section rules
[Jun 16 10:43:34] DEBUG[26345]: res_pjsip_endpoint_identifier_user.c:137 username_identify: Attempting identify by From username '<not my phone number>' domain '172.30.XX.XX'
[Jun 16 10:43:34] DEBUG[26345]: res_pjsip_endpoint_identifier_user.c:141 username_identify: Endpoint not found for From username '<not my phone number>' domain '172.30.XX.XX'

Please mark up your code and logs properly for the forum, using </> form the menu bar.

Also, as previously requested, please enable, and include the pjsip protocol logging, so we can see exactly what is being received.

The errors on the log relate to the contents of pjsip.con, so we will also need that.

Which is the strange number in the log?

INVITE sip:<Sim card number>@10.XX.XX.XX:5060 SIP/2.0
Via: SIP/2.0/UDP XX.XX.XX.XX:5060;branch=z9hG4bK+e4c79eece5002c3e93b57c38780ded3a1+sip+1+b5c097a5
From: <sip:<my number>@172.30.XX.XX:5060>;tag=XX.XX.XX.XX+1+d754088f+29d4d3e0
To: <sip:<softphone number>@172.30.XX.XX>
CSeq: 98933625 INVITE
Expires: 180
Content-Length: 174
Call-Info: <sip:XX.XX.XX.XX:5060>;method="NOTIFY;Event=telephone-event;Duration=2000"
Supported: resource-priority, 100rel
Contact: <sip:db6604108f7174dbebf511f27ff1bf16@XX.XX.XX.XX:5060>
Content-Type: application/sdp
Allow-Events: message-summary, refer, dialog, line-seize, presence, call-info, as-feature-event
Call-ID: 0gQAAC8WAAACBAAALxYAAJ0aJUYI6npBvoNny/SMXjL7fMSihDUNc3bksHLYAmBp@XX.XX.XX.XX
Organization: XX XX
Max-Forwards: 69
Accept: application/sdp, application/dtmf-relay

v=0
o=- 44884078432671 44884078432671 IN IP4 XX.XX.XX.XX
s=-
c=IN IP4 XX.XX.XX.XX
t=0 0
m=audio 37632 RTP/AVP 18 101
a=rtpmap:101 telephone-event/8000
a=ptime:80

<--- Transmitting SIP response (647 bytes) to UDP:XX.XX.XX.XX:5060 --->
SIP/2.0 401 Unauthorized
Via: SIP/2.0/UDP XX.XX.XX.XX:5060;rport=5060;received=XX.XX.XX.XX;branch=z9hG4bK+e4c79eece5002c3e93b57c38780ded3a1+sip+1+b5c097a5
Call-ID: 0gQAAC8WAAACBAAALxYAAJ0aJUYI6npBvoNny/SMXjL7fMSihDUNc3bksHLYAmBp@XX.XX.XX.XX
From: <sip:<my number>@172.30.XX.XX>;tag=XX.XX.XX.XX+1+d754088f+29d4d3e0
To: <sip:<number im trying to call>@172.30.XX.XX>;tag=z9hG4bK+e4c79eece5002c3e93b57c38780ded3a1+sip+1+b5c097a5
CSeq: 98933625 INVITE
WWW-Authenticate: Digest  realm="asterisk",nonce="1592311980/118bcf27b56fb4d45d366cb2a16a03e9",opaque="6509481606fc3f61",algorithm=md5,qop="auth"
Server: Asterisk PBX 15.2.2
Content-Length:  0

the same sequnce then repeats with my number replaced with 0087 number

As a general rule, service providers want you to prove who you are (outbound authentication), but are never prepared to prove who they are (inbound authentication). In this case, you have configured Asterisk ask them to prove who they are, and they are unable to do so, so the call never gets anywhere.

Inbound and outbound are with respect to your Asterisk daemon.

how would i change this so asterisk does not ask them? Is there a line I can add to the pjsip.conf?

SIM cards have no meaning to SIP service providers, so the only way they could know that is if you included it in your registration.

I’m not clear what softphone number is.

The hint to what to change is my previous response. The first example I found in the sample pjsip.conf shows how to avoid trying to authenticate the peer.

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.