Transfer with channel inside of stasis app is strange

I’m using asterisk 18.14.0 and ari4java version 0.16.0
scenario A is:
Extension A dial Extension B, and after answer Extension B transfer to Extension C,
when B transfer to C the dial plan shows correctly the CallerID(num) and the From header,
this is my dial plan:
same => n,NoOp(CALLER ID NUM=${CALLERID(num)})
same => n,NoOp(CALLER ID NAME=${CALLERID(name)})
same => n,Set(FROM=${PJSIP_HEADER(read,From)})

this is there refer sip message:

REFER sip:asterisk@192.168.3.156:5060 SIP/2.0
Via: SIP/2.0/UDP 192.168.3.87;branch=z9hG4bK41b9.9335e63df7e92b1691858bde271f22e6.0
Via: SIP/2.0/UDP 192.168.98.40:59945;received=192.168.98.40;branch=z9hG4bK-d8754z-9539dd2dab58f67c-1—d8754z-;rport=59945
Max-Forwards: 69
Contact: sip:1-4901@192.168.98.40:59945;rinstance=b41ebd2f6c6aaa7d
To: "b0fa7f53-1163-49a4-88b3-4d7aabe97f97|1"sip:9124619152@192.168.3.156;tag=3d7e53ee-8c85-4b3d-8815-be8c5eb06989
From: sip:1-4901@192.168.3.87;tag=6f63f349
Call-ID: 75c9c940-e2e2-4d0f-9248-4b7ca3181ce7
CSeq: 3 REFER
User-Agent: 3CXPhone 6.0.26523.0
Refer-To: sip:4905@192.168.3.87:5060
Referred-By: sip:1-4901@192.168.3.87
Content-Length: 0

<— Transmitting SIP response (759 bytes) to UDP:192.168.3.87:5060 —>
SIP/2.0 202 Accepted
Via: SIP/2.0/UDP 192.168.3.87;rport=5060;received=192.168.3.87;branch=z9hG4bK41b9.9335e63df7e92b1691858bde271f22e6.0
Via: SIP/2.0/UDP 192.168.98.40:59945;rport=59945;received=192.168.98.40;branch=z9hG4bK-d8754z-9539dd2dab58f67c-1—d8754z-
Call-ID: 75c9c940-e2e2-4d0f-9248-4b7ca3181ce7
From: sip:1-4901@192.168.3.87;tag=6f63f349
To: “b0fa7f53-1163-49a4-88b3-4d7aabe97f97|1” sip:9124619152@192.168.3.156;tag=3d7e53ee-8c85-4b3d-8815-be8c5eb06989
CSeq: 3 REFER
Expires: 600
Contact: sip:asterisk@192.168.3.156:5060
Allow: OPTIONS, REGISTER, SUBSCRIBE, NOTIFY, PUBLISH, INVITE, ACK, BYE, CANCEL, UPDATE, PRACK, MESSAGE, REFER
Supported: 100rel, timer, replaces, norefersub
Server: Asterisk PBX 18.14.0
Content-Length: 0

and as you can see the caller id and FROM header are correct in asterisk logs:

-- Executing [4905@tgui-out:5] NoOp("PJSIP/kamailio-00001bde", "CALLER ID NUM=9124619152") in new stack
-- Executing [4905@tgui-out:6] NoOp("PJSIP/kamailio-00001bde", "CALLER ID NAME=121") in new stack
-- Executing [4905@tgui-out:7] Set("PJSIP/kamailio-00001bde", "FROM="121" <sip:1-121@192.168.3.87>;tag=9b502b65") in new stack

scenario B:

Extension A call the Queue Stasis App, the Stasis app dial Extension B and after pickup create bridge and they start talking, now Extension B transfer to Extension C
when B transfer to C the dial plan shows empty CallerID(num) and says it not PJSIP channel and I could’nt get From header!!!

this is refer sip message:
<— Received SIP request (780 bytes) from UDP:192.168.3.87:5060 —>
REFER sip:asterisk@192.168.3.156:5060 SIP/2.0
Via: SIP/2.0/UDP 192.168.3.87;branch=z9hG4bK13bf.b3d4760c69f11dc9e70c3f8475374aca.0
Via: SIP/2.0/UDP 192.168.98.40:59945;received=192.168.98.40;branch=z9hG4bK-d8754z-1b2b8051ce11770c-1—d8754z-;rport=59945
Max-Forwards: 69
Contact: sip:1-4901@192.168.98.40:59945;rinstance=b41ebd2f6c6aaa7d
To: "121|db66ae7a-d18c-46c5-bab6-8a4364c667e7|aroontan second test 4046|1|null|null|null|null|null|null|null|1|20|no|no"sip:9124619152@192.168.3.156;tag=8d4168a4-46ad-4c34-84e4-246080c21175
From: sip:1-4901@192.168.3.87;tag=fd010f5f
Call-ID: 77ba6ece-9b2d-4385-8fba-b64bcbcc5514
CSeq: 3 REFER
User-Agent: 3CXPhone 6.0.26523.0
Refer-To: sip:4905@192.168.3.87:5060
Referred-By: sip:1-4901@192.168.3.87
Content-Length: 0

<— Transmitting SIP response (835 bytes) to UDP:192.168.3.87:5060 —>
SIP/2.0 202 Accepted
Via: SIP/2.0/UDP 192.168.3.87;rport=5060;received=192.168.3.87;branch=z9hG4bK13bf.b3d4760c69f11dc9e70c3f8475374aca.0
Via: SIP/2.0/UDP 192.168.98.40:59945;rport=59945;received=192.168.98.40;branch=z9hG4bK-d8754z-1b2b8051ce11770c-1—d8754z-
Call-ID: 77ba6ece-9b2d-4385-8fba-b64bcbcc5514
From: sip:1-4901@192.168.3.87;tag=fd010f5f
To: “121|db66ae7a-d18c-46c5-bab6-8a4364c667e7|aroontan second test 4046|1|null|null|null|null|null|null|null|1|20|no|no” sip:9124619152@192.168.3.156;tag=8d4168a4-46ad-4c34-84e4-246080c21175
CSeq: 3 REFER
Expires: 600
Contact: sip:asterisk@192.168.3.156:5060
Allow: OPTIONS, REGISTER, SUBSCRIBE, NOTIFY, PUBLISH, INVITE, ACK, BYE, CANCEL, UPDATE, PRACK, MESSAGE, REFER
Supported: 100rel, timer, replaces, norefersub
Server: Asterisk PBX 18.14.0
Content-Length: 0

and this is the log asterisk:
– Executing [4905@tgui-out:5] NoOp(“Local/4905@tgui-out-0000035f;2”, “CALLER ID NUM=”) in new stack
– Executing [4905@tgui-out:6] NoOp(“Local/4905@tgui-out-0000035f;2”, “CALLER ID NAME=”) in new stack
– Channel PJSIP/kamailio-00001bdd left ‘softmix’ stasis-bridge <106317bf-2763-4b34-947d-12bf2aa6e70d>
[May 22 17:55:53] ERROR[1180152][C-00000e4a]: res_pjsip_header_funcs.c:779 func_read_header: This function requires a PJSIP channel.
– Executing [4905@tgui-out:7] Set(“Local/4905@tgui-out-0000035f;2”, “FROM=”) in new stack
– Channel Local/4905@tgui-out-0000035f;1 swapped with PJSIP/kamailio-00001bdd into ‘softmix’ stasis-bridge <106317bf-2763-4b34-947d-12bf2aa6e70d>

what should I do to get From header and why it’s not pjsip channel?

It’s not a PJSIP channel because the transfer uses a local channel because it needs to be able to run dialplan on the outgoing leg. The local channel will optimise out the call connects. It can’t run on the incoming channel, as that is already running the stasis application and may be calling other devices.

I’m surprised the caller ID isn’t available.

thanks for your response,
why when I tired the extension directly the transfer occur in actual channel, but when its from bridge in stasis app the transfer occur in local channel?

I also tried to set From header into inherit variable from the first call:
same => n,Set(__FROMORIGIN=${FROM})
but when I get it it’s empty too:
same => n,NoOp(FROM ORIGIN=${FROMORIGIN})

is there anyway I can read something (header/variable/…) from origin call inside this local channel?
is there any workaround ?

With pjsip you have to

same => n,Set(__FROMORIGIN=PJSIP_HEADER(read,FROM))

I use it in first call and get the From header but in transfer call it is local channel and it is not pjsip channel so I can’t get it, the result as I post in first question is this:
[May 22 17:55:53] ERROR[1180152][C-00000e4a]: res_pjsip_header_funcs.c:779 func_read_header: This function requires a PJSIP channel.
– Executing [4905@tgui-out:7] Set(“Local/4905@tgui-out-0000035f;2”, “FROM=”) in new stack

When unbridged the call is presumably unanswered, so it is 302 redirect.

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