Mapping call from PJSIP server to PJSIP server

Hello, as I shared you before, I am trying to connect two asterisk servers using PJSIP trunk.

My goal is: When call arrives in server1 to map the call/forward the call in to the server2 using PJSIP trunk between the two servers.
Note: All users and queues calls are in server2. Server1 will just recieve the signal from the SIP trunk/E1 PSTN.

Current, The incoming call is working. The call arrives in server2.

The issue is Outbound calls.

Here is My Trunk between the two asterisk servers
Server1: 192.x.x…x.76
Server2: 192.x.x.x75
server1:in psjip.conf
[mytrunk]
type=registration
outbound_auth=mytrunk
server_uri=sip:192.x.x.x75
client_uri=sip:user@192.x.x.x75
retry_interval=60

[mytrunk]
type=auth
auth_type=userpass
password=user
username=2233444

[mytrunk]
type=aor
contact=sip:192.x.x.x75:5060

[mytrunk]
type=endpoint
context=from-pstn
disallow=all
allow=ulaw
outbound_auth=mytrunk
aors=mytrunk

[mytrunk]
type=identify
endpoint=mytrunk
match=192.x.x.75

server2 in pjsip.conf

[mytrunk]
type=registration
outbound_auth=mytrunk
server_uri=sip:192.x.x.x75
client_uri=sip:user@192.x.x.x75
retry_interval=60

[mytrunk]
type=auth
auth_type=userpass
password=user
username=2233444

[mytrunk]
type=aor
contact=sip:192.x.x.x75:5060

[mytrunk]
type=endpoint
context=from-pstn
disallow=all
allow=ulaw
outbound_auth=mytrunk
aors=mytrunk

[mytrunk]
type=identify
endpoint=mytrunk
match=192.168.x.x.76

when I am making ouboud call from server2 I am getting this error from the PJSIP logger on:

PJSIP Logging enabled
<— Received SIP request (983 bytes) from UDP:192.x.x.x.x:55597 —>
INVITE sip:09xxxxxxxx@192.x.x.x75 SIP/2.0
Via: SIP/2.0/UDP 192.x.x.x.x:55597;rport;branch=z9hG4bKPj2fdbf4175dbc411abba76811f343beeb
Max-Forwards: 70
From: sip:3001@192.x.x.x75;tag=213f9302c3c9496989dcd16e24e93248
To: sip:09xxxxxx@192.x.x.x75
Contact: sip:3001@192.x.x.x.x:55597;ob
Call-ID: a2a41e0b469346aba0bddff97503e1bb
CSeq: 5245 INVITE
Allow: PRACK, INVITE, ACK, BYE, CANCEL, UPDATE, INFO, SUBSCRIBE, NOTIFY, REFER, MESSAGE, OPTIONS
Supported: replaces, 100rel, timer, norefersub
Session-Expires: 1800
Min-SE: 90
User-Agent: SoftphonePro 5.3.0.0
Content-Type: application/sdp
Content-Length: 345

v=0
o=- 3906265364 3906265364 IN IP4 192.x.x.x.x
s=pjmedia
b=AS:84
t=0 0
a=X-nat:1
m=audio 65206 RTP/AVP 8 0 101
c=IN IP4 192.x.x.x.x
b=TIAS:64000
a=rtcp:65207 IN IP4 192.x.x.x.x
a=sendrecv
a=rtpmap:8 PCMA/8000
a=rtpmap:0 PCMU/8000
a=rtpmap:101 telephone-event/8000
a=fmtp:101 0-16
a=ssrc:1397239416 cname:0855010c36a87d3e

<— Transmitting SIP response (559 bytes) to UDP:192.x.x.x.x:55597 —>
SIP/2.0 401 Unauthorized
Via: SIP/2.0/UDP 192.x.x.x.x:55597;rport=55597;received=192.x.x.x.x;branch=z9hG4bKPj2fdbf4175dbc411abba76811f343beeb
Call-ID: a2a41e0b469346aba0bddff97503e1bb
From: sip:3001@192.x.x.x75;tag=213f9302c3c9496989dcd16e24e93248
To: sip:09xxxxxx@192.x.x.x75;tag=z9hG4bKPj2fdbf4175dbc411abba76811f343beeb
CSeq: 5245 INVITE
WWW-Authenticate: Digest realm=“asterisk”,nonce=“1697265752/a05feff2edbd96306ac26ed877d255e1”,opaque=“01bfb4e1354418e8”,algorithm=MD5,qop=“auth”
Server: Asterisk PBX 18.19.0
Content-Length: 0

<— Received SIP request (385 bytes) from UDP:192.x.x.x.x:55597 —>
ACK sip:09xxxxx@192.x.x.x75 SIP/2.0
Via: SIP/2.0/UDP 192.x.x.x.x:55597;rport;branch=z9hG4bKPj2fdbf4175dbc411abba76811f343beeb
Max-Forwards: 70
From: sip:3001@192.x.x.x75;tag=213f9302c3c9496989dcd16e24e93248
To: <sip:09xxxxxx
@192.x.x.x75>;tag=z9hG4bKPj2fdbf4175dbc411abba76811f343beeb
Call-ID: a2a41e0b469346aba0bddff97503e1bb
CSeq: 5245 ACK
Content-Length: 0

<— Received SIP request (1282 bytes) from UDP:192.x.x.x.x:55597 —>
INVITE sip:09xxxxxx@192.x.x.x75 SIP/2.0
Via: SIP/2.0/UDP 192.x.x.x.x:55597;rport;branch=z9hG4bKPj77b7929478aa4dc08a0e5bfe49969ad1
Max-Forwards: 70
From: sip:3001@192.x.x.x75;tag=213f9302c3c9496989dcd16e24e93248
To: sip:09xxxxxx@192.x.x.x75
Contact: sip:3001@192.x.x.x.x:55597;ob
Call-ID: a2a41e0b469346aba0bddff97503e1bb
CSeq: 5246 INVITE
Allow: PRACK, INVITE, ACK, BYE, CANCEL, UPDATE, INFO, SUBSCRIBE, NOTIFY, REFER, MESSAGE, OPTIONS
Supported: replaces, 100rel, timer, norefersub
Session-Expires: 1800
Min-SE: 90
User-Agent: SoftphonePro 5.3.0.0
Authorization: Digest username=“3001”, realm=“asterisk”, nonce=“1697265752/a05feff2edbd96306ac26ed877d255e1”, uri=“sip:09xxxx@192.xxx.75”, response=“5f234cc367b18341ec3febcb85736787”, algorithm=MD5, cnonce=“54946f8f648f4367811ce679dc92ea7e”, opaque=“01bfb4e1354418e8”, qop=auth, nc=00000001
Content-Type: application/sdp
Content-Length: 345

v=0
o=- 3906265364 3906265364 IN IP4 192.x.x.x.x
s=pjmedia
b=AS:84
t=0 0
a=X-nat:1
m=audio 65206 RTP/AVP 8 0 101
c=IN IP4 192.x.x.x.x
b=TIAS:64000
a=rtcp:65207 IN IP4 192.x.x.x.x
a=sendrecv
a=rtpmap:8 PCMA/8000
a=rtpmap:0 PCMU/8000
a=rtpmap:101 telephone-event/8000
a=fmtp:101 0-16
a=ssrc:1397239416 cname:0855010c36a87d3e

<— Transmitting SIP response (361 bytes) to UDP:192.x.x.x.x:55597 —>
SIP/2.0 100 Trying
Via: SIP/2.0/UDP 192.x.x.x.x:55597;rport=55597;received=192.x.x.x.x;branch=z9hG4bKPj77b7929478aa4dc08a0e5bfe49969ad1
Call-ID: a2a41e0b469346aba0bddff97503e1bb
From: sip:3001@192.x.x.x75;tag=213f9302c3c9496989dcd16e24e93248
To: sip:09xxxx@192.x.x.x75
CSeq: 5246 INVITE
Server: Asterisk PBX 18.19.0
Content-Length: 0

-- Executing [09xxxxx@mytrunk:1] Set("PJSIP/3001-00000008", "CALLERID(number)=+26xxxxxxx20") in new stack
-- Executing [09xxxxxxx@mytrunk:2] Dial("PJSIP/3001-00000008", "PJSIP/09xxxxx@mytrunk") in new stack
-- Called PJSIP/09xxxxxx@mytrunk

<— Transmitting SIP request (923 bytes) to UDP:192.x.x.x76:5060 —>
INVITE sip:09xxxxx@192.x.x.x76:5060 SIP/2.0
Via: SIP/2.0/UDP 192.x.x.x75:5060;rport;branch=z9hG4bKPj506f03e8-4b0a-4b31-a823-7b8233fe03d6
From: sip:+26xxxxxxx20@192.x.x.x75;tag=da2401e1-bdf9-46f4-98ad-5b9c4d21a931
To: sip:09xxxxx@192.x.x.x76
Contact: sip:asterisk@192.x.x.x75:5060
Call-ID: 458f338c-6537-4fdf-a9f5-5f2652304eca
CSeq: 3158 INVITE
Allow: OPTIONS, REGISTER, SUBSCRIBE, NOTIFY, PUBLISH, INVITE, ACK, BYE, CANCEL, UPDATE, PRACK, MESSAGE, REFER
Supported: 100rel, timer, replaces, norefersub, histinfo
Session-Expires: 1800
Min-SE: 90
Max-Forwards: 70
User-Agent: Asterisk PBX 18.19.0
Content-Type: application/sdp
Content-Length: 237

v=0
o=- 177994976 177994976 IN IP4 192.x.x.x75
s=Asterisk
c=IN IP4 192.x.x.x75
t=0 0
m=audio 13290 RTP/AVP 0 101
a=rtpmap:0 PCMU/8000
a=rtpmap:101 telephone-event/8000
a=fmtp:101 0-16
a=ptime:20
a=maxptime:150
a=sendrecv

<— Received SIP response (424 bytes) from UDP:192.x.x.x76:5060 —>
SIP/2.0 404 Not Found
Via: SIP/2.0/UDP 192.x.x.x75:5060;rport=5060;received=192.x.x.x75;branch=z9hG4bKPj506f03e8-4b0a-4b31-a823-7b8233fe03d6
Call-ID: 458f338c-6537-4fdf-a9f5-5f2652304eca
From: sip:+26xxxxxxx20@192.x.x.x75;tag=da2401e1-bdf9-46f4-98ad-5b9c4d21a931
To: sip:09xxxxx@192.x.x.x76;tag=8c4dcb9b-865a-43e4-b8c8-c856c3ea4909
CSeq: 3158 INVITE
Server: Asterisk PBX 18.19.0
Content-Length: 0

<— Transmitting SIP request (439 bytes) to UDP:192.x.x.x76:5060 —>
ACK sip:09xxxx@192.xxx.76:5060 SIP/2.0
Via: SIP/2.0/UDP 192.x.x.x75:5060;rport;branch=z9hG4bKPj506f03e8-4b0a-4b31-a823-7b8233fe03d6
From: sip:+26xxxxxxx20@192.x.x.x75;tag=da2401e1-bdf9-46f4-98ad-5b9c4d21a931
To: sip:09xxxxx@192.x.x.x76;tag=8c4dcb9b-865a-43e4-b8c8-c856c3ea4909
Call-ID: 458f338c-6537-4fdf-a9f5-5f2652304eca
CSeq: 3158 ACK
Max-Forwards: 70
User-Agent: Asterisk PBX 18.19.0
Content-Length: 0

== Everyone is busy/congested at this time (1:0/0/1)
– Executing [09xxxxxxx
@mytrunk:3] Hangup(“PJSIP/3001-00000008”, “”) in new stack
== Spawn extension (mytrunk, 09xxxxxx, 3) exited non-zero on ‘PJSIP/3001-00000008’
<— Transmitting SIP response (428 bytes) to UDP:192.x.x.x.x:55597 —>
SIP/2.0 404 Not Found
Via: SIP/2.0/UDP 192.x.x.x.x:55597;rport=55597;received=192.x.x.x.x;branch=z9hG4bKPj77b7929478aa4dc08a0e5bfe49969ad1
Call-ID: a2a41e0b469346aba0bddff97503e1bb
From: sip:3001@192.x.x.x75;tag=213f9302c3c9496989dcd16e24e93248
To: sip:09xxxxx@192.x.x.x75;tag=f124ae08-e3e5-4491-80a0-c4fa71e1af05
CSeq: 5246 INVITE
Server: Asterisk PBX 18.19.0
Reason: Q.850;cause=1
Content-Length: 0

<— Received SIP request (380 bytes) from UDP:192.x.x.x.x:55597 —>
ACK sip:09xxxxxx@192.x.x.x75 SIP/2.0
Via: SIP/2.0/UDP 192.x.x.x.x:55597;rport;branch=z9hG4bKPj77b7929478aa4dc08a0e5bfe49969ad1
Max-Forwards: 70
From: sip:3001@192.x.x.x75;tag=213f9302c3c9496989dcd16e24e93248
To: sip:09xxxxxx@192.x.x.x75;tag=f124ae08-e3e5-4491-80a0-c4fa71e1af05
Call-ID: a2a41e0b469346aba0bddff97503e1bb
CSeq: 5246 ACK
Content-Length: 0

Having registration on both sides makes no sense, as to send registration you need to know the address of the other side, so you don’t need it to register with you for you to learn the address. Registration is not an authentication step.

This is an invalid redacted IP address.

You haen’t provided the logging from the servers with the final destinations, and you haven’t provided its extensions.conf, so I can’t tell if the call is being routed to from_pstn, and whether from_pstn actually contains 09xxxxxx.

Do you mean, Share the Extensions.conf from the Destination server?

No, the extension.conf.

Or at least the part of it that you believe match from_pstn,09xxxxxx,1 including the context header.

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