Call forward with refer and CTI data

I am working on setting up call forwarding. Currently, a user calls PBX A (not my PBX) from the PSTN, and then PBX A forwards the call to my Asterisk PBX. PBX A and my Asterisk PBX are connected via a SIP trunk. (PBX A registered in Asterisk PBX pjsip as a endpoint)

; pjsip in Asterisk PBX
[PBX_A]
type=endpoint
context=PBX_A
disallow=all
allow=ulaw
outbound_auth=PBX_A
aors=PBX_A

[PBX_A]
type=auth
auth_type=userpass
password=
username=

[PBX_A]
type=aor
contact=sip:XX.XXX.XX.XX:5060
max_contacts=1

The call flow is as follows: User from PSTN → PBX A → Asterisk PBX

Now, I want to forward the user’s call back to an endpoint in PBX A (let say endpoint 5555). I am using the Dial() function in Asterisk. However, PBX A requires that I use a REFER package for call forwarding. How can I achieve this?

Here is the example that PBX A expects:

Thanks

https://docs.asterisk.org/Asterisk_20_Documentation/API_Documentation/Dialplan_Applications/Transfer/

Thanks for reply.

I tried Transfer(), but it cannot transfer the call to the PBX A endpoint.
It will make the call end.
Here is my code:

; when user click #, user will goto this Transfer function
exten = 1234,1,Transfer(pjsip/5555@PBX_A)

I used WireShark to catch the SIP package, nothing happend related to PBX_A.
It only stay in the local network. All IP are Asterisk local IP, the final error is SIP/2.0 500 Server Internal Error, which the error is come from Asterisk PBX.

chan_pjsip requires a full URI after the /.

Also note that, to use REFER, the call must have been answered, otherwise a 302 status will be used.

Sorry I am new in Asterisk.
May I ask for an example of ‘full URI after the /’ ?

If the IP address is XX.XXX.XX.XX, Is it look like this?

pjsip/XX.XXX.XX.XX:5060/5555

Thanks

See SIP-URI and SIPS-URI, towards the middle of this page RFC 3261: SIP: Session Initiation Protocol

However, you cannot set even valid headers on REFER, and CTI_Data is not a valid header name, as it is not marked as being non-standard, and there appears to be no RFC defining it.

Do you mean that I cannot set CTI_Data in the Refer with Asterisk?

Seem it can transfer the call, but the call changed to on hold, after a few seconds it pop up Time out request
PBX_A still did not receive anything.

Am I missing anything?

Here is my extensions.conf in Asterisk
image
image

Here is my Refer package, which 10.11.30.80 is my Asterisk PBX local IP

Thanks

Please provide the complete REFER transaction, as plain text, not an image.

Sorry about it, here is the plain text
I saw there are a 5524 NOTIFY after the call forward.

In this case, call flow:
1001@10.11.30.26 → (call) → 1000@10.11.30.80 → (call forward) → sip:5555@XX.XXX.XX.XX

<--- Transmitting SIP request (706 bytes) to UDP:10.11.30.26:56759 --->
REFER sip:1001@10.11.30.26:56759;ob SIP/2.0
Via: SIP/2.0/UDP 10.11.30.80:5060;rport;branch=z9hG4bKPj60da3e12-d22f-423a-a861-63603849a018
From: <sip:1000@10.11.30.80>;tag=861253b2-54ff-4312-9b16-08b479ac4b6f
To: <sip:1001@10.11.30.80>;tag=22c973b683c441419e4fe51990df640a
Contact: <sip:10.11.30.80:5060>
Call-ID: 6d805f31f53d4ad7b8ceaf7018b2c202
CSeq: 5881 REFER
Event: refer
Expires: 600
Supported: 100rel, timer, replaces, norefersub
Accept: message/sipfrag;version=2.0
Allow-Events: presence, dialog, message-summary, refer
Refer-To: sip:5555@XX.XXX.XX.XX
Referred-By: <sip:1000@10.11.30.80>
Max-Forwards: 70
User-Agent: Asterisk PBX 18.10.0~dfsg+~cs6.10.40431411-2
Content-Length:  0


<--- Received SIP response (576 bytes) from UDP:10.11.30.26:56759 --->
SIP/2.0 202 Accepted
Via: SIP/2.0/UDP 10.11.30.80:5060;rport=5060;received=10.11.30.80;branch=z9hG4bKPj60da3e12-d22f-423a-a861-63603849a018
Call-ID: 6d805f31f53d4ad7b8ceaf7018b2c202
From: <sip:1000@10.11.30.80>;tag=861253b2-54ff-4312-9b16-08b479ac4b6f
To: <sip:1001@10.11.30.80>;tag=22c973b683c441419e4fe51990df640a
CSeq: 5881 REFER
Expires: 600
Contact: <sip:1001@10.11.30.26:56759;ob>
Allow: PRACK, INVITE, ACK, BYE, CANCEL, UPDATE, INFO, SUBSCRIBE, NOTIFY, REFER, MESSAGE, OPTIONS
Supported: replaces, 100rel, timer, norefersub, trickle-ice
Content-Length:  0


<--- Received SIP response (576 bytes) from UDP:10.11.30.26:56759 --->
SIP/2.0 202 Accepted
Via: SIP/2.0/UDP 10.11.30.80:5060;rport=5060;received=10.11.30.80;branch=z9hG4bKPj60da3e12-d22f-423a-a861-63603849a018
Call-ID: 6d805f31f53d4ad7b8ceaf7018b2c202
From: <sip:1000@10.11.30.80>;tag=861253b2-54ff-4312-9b16-08b479ac4b6f
To: <sip:1001@10.11.30.80>;tag=22c973b683c441419e4fe51990df640a
CSeq: 5881 REFER
Expires: 600
Contact: <sip:1001@10.11.30.26:56759;ob>
Allow: PRACK, INVITE, ACK, BYE, CANCEL, UPDATE, INFO, SUBSCRIBE, NOTIFY, REFER, MESSAGE, OPTIONS
Supported: replaces, 100rel, timer, norefersub, trickle-ice
Content-Length:  0


<--- Received SIP request (576 bytes) from UDP:10.11.30.26:56759 --->
NOTIFY sip:10.11.30.80:5060 SIP/2.0
Via: SIP/2.0/UDP 10.11.30.26:56759;rport;branch=z9hG4bKPj418872ed3dcf4a4a8035dffe3082ea02
Max-Forwards: 70
From: <sip:1001@10.11.30.80>;tag=22c973b683c441419e4fe51990df640a
To: <sip:1000@10.11.30.80>;tag=861253b2-54ff-4312-9b16-08b479ac4b6f
Contact: <sip:1001@10.11.30.26:56759;ob>
Call-ID: 6d805f31f53d4ad7b8ceaf7018b2c202
CSeq: 5524 NOTIFY
Event: refer
Subscription-State: active;expires=600
Allow-Events: presence, message-summary, refer
Content-Type: message/sipfrag;version=2.0
Content-Length:    20

SIP/2.0 100 Trying

Thanks a lot !

You will need to debug this on 10.11.30.26. It has accepted responsibility for the REFER and appears to be still executing it when the log ends.

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