Asterisk DTMF Attendant Transfer and Callerid problem

I an experiencing something strange with DTMF Attendant transfer. The callerid(num) is not getting set:

– Channel PJSIP/180-00074c24: Started DTMF attended transfer.
– <PJSIP/180-00074c24> Playing ‘pbx-transfer.gsm’ (language ‘en’)

– Executing [s@set-outcallerid:2] Set(“Local/**911@extensions-00000cc4;2”, “callerid=27110296123”) in new stack
– Executing [s@set-outcallerid:3] ExecIf(“Local/**911@extensions-00000cc4;2”, “0?SET(callerid=180)”) in new stack
– Executing [s@set-outcallerid:4] **Set("Local/911@extensions-00000cc4;2", “CALLERID(num)=27123456789”) in new stack
– Executing [s@set-outcallerid:5] ExecIf(“Local/**911@extensions-00000cc4;2”, “0?Set(CALLERID(num)=)”) in new stack
– Executing [s@set-outcallerid:6] Return(“Local/**911@extensions-00000cc4;2”, “”) in new stack
– Executing [s@trunk:15] System(“Local/**911@extensions-00000cc4;2”, “echo “1704177208|1704177208.4453455|webrtc_outbound|PJSIP/180|CALLOUTBOUND||0123456789” >> /var/log/asterisk/queue_log”) in new stack
– Executing [s@trunk:16] Dial(“Local/**911@extensions-00000cc4;2”, “PJSIP/0123456789@vc2,300,TrU(connected,PJSIP/180,1704177208,1704177208.4453455)”) in new stack
– Called PJSIP/0123456789@vc2
– PJSIP/vc2-00074c26 answered Local/**911@extensions-00000cc4;2

My Voice Core server then receives the calls as:

– Executing [s@macro-clientdial:2] Set(“SIP/vc2-001b2e07”, “CALLERID(NUM)=180”) in new stack

Regards

Kindly try this

dtmf_passthrough=yes

on the confbridge.conf

I have tried that:
DTMF Pass Through: enabled

Also DTMF should have nothing to do with the Callerid(num)

You need to provide the dialplan you are using, as I don’t think we can reconstruct it from the log fragments given.

Please see below: (You might have to remove some of the bloat)

We are making use of the Asterisk DTMF feature transfer:

[general]
atxfer => ** ; Attended transfer – Make sure to set the T and/or t option in the Dial() or Queue() app call!

[set-outcallerid]
exten => s,1,ExecIf($[${LEN(${CFEXT})}=0]?Set(EXT=${CALLERID(num)}))
exten => s,n,Set(callerid=${ODBC_outcallerid(${EXT})})
exten => s,n,Execif($[$[${LEN(${callerid})}=0] | $[“${callerid}”=“NULL”]]?SET(callerid=${EXT}))
exten => s,n,Set(CALLERID(num)=${callerid})
exten => s,n,ExecIf($[“${CLOUDCALL}”=“yes”]?Set(CALLERID(num)=${CFEXT}))
exten => s,n,Return()

[connected]
exten => s,1,Set(AGENT=${ARG1})
exten => s,n,Set(HOLDTIME=$[${EPOCH}-${ARG2}])
exten => s,n,System(echo “${EPOCH}|${ARG3}|${QUEUE_OUT}|${AGENT}|CONNECT|${HOLDTIME}|${ARG3}|${HOLDTIME}” >> /var/log/asterisk/queue_log)
exten => s,n,Return()

[trunk]
exten => s,1,Gosub(check-record,s,1)
exten => s,n,Set(__SIPCALLID=${PJSIP_HEADER(read,Call-id)})
exten => s,n,Set(__APIURL=${PJSIP_HEADER(read,set-callid-server-uri)})
exten => s,n,Set(AGENT=PJSIP/${CALLERID(num)})
exten => s,n,Set(__NUM=${ARG1})
exten => s,n,Set(CHANNEL(hangup_handler_push)=hdlr3,h,1)
exten => s,n,Execif(${BLINDTRANSFER}?Set(temp=${CUT(BLINDTRANSFER,-,1)}))
exten => s,n,Execif(${FORWARDERNAME}?Set(temp=${CUT(FORWARDERNAME,-,1)}))
exten => s,n,Execif($[$[${LEN(${FORWARDERNAME})}>1]|$[${LEN(${BLINDTRANSFER})}>1]]?Set(EXT=${CUT(temp,/,2)}))
exten => s,n,Execif($[$[${LEN(${FORWARDERNAME})}>1]|$[${LEN(${BLINDTRANSFER})}>1]]?Set(CFEXT=${CUT(temp,/,2)}))
exten => s,n,Gosub(check-pin,s,1(${ARG1}))
exten => s,n,Gosub(set-outcallerid,s,1)
exten => s,n,System(echo “${EPOCH}|${UNIQUEID}|${QUEUE_OUT}|${AGENT}|CALLOUTBOUND||${ARG1}” >> /var/log/asterisk/queue_log)
exten => s,n,Dial(${STRREPLACE(TRUNK,“dst”,${ARG1})},300,TrU(connected,${AGENT},${EPOCH},${UNIQUEID}))
exten => s,n,Dial(${STRREPLACE(FAILTRUNK,“dst”,${ARG1})},300,TrU(connected,${AGENT},${EPOCH},${UNIQUEID}))
exten => s,n,Busy

Scenario:

  1. Call received from Caller A to Agent A in a Queue.
  2. Agent A, DTMF Attendant transfer to remote party (Example is speed dial - External number)
  3. Agent A disconnects calls to connect remote party with Caller A

Which header are you using for caller ID? What is the from user set to?

Note that you don’t need to nest $[…] around every subexpression. It makes reading the expressions more difficult.

I don’t have a from_user set on the trunk:

Endpoint: vc2 Not in use 0 of inf
OutAuth: vc2/vc2
Aor: vc2 0
Contact: vc2/sip:1.1.1.1:5060 4e1d67f7cb Avail 2.438
Identify: vc2/vc2
Match: 1.1.1.1/32

ParameterName : ParameterValue
100rel : yes
accept_multiple_sdp_answers : false
accountcode :
acl :
aggregate_mwi : true
allow : (g729)
allow_overlap : true
allow_subscribe : true

force_avp : false
force_rport : true
from_domain :
from_user :
g726_non_standard : false
ice_support : false
identify_by : username,ip
ignore_183_without_sdp : false

More CLI Info:
Channel PJSIP/180-0007525e: Started DTMF attended transfer.

set-outcallerid:4] Set(“Local/**911@extensions”, “CALLERID(num)=27123456789”) in new stack

trunk:16] Dial(“Local/**911@extensions”, “PJSIP/0123456789@vc2,300,Tr”) in new stack

PJSIP Debug:
From: “Webrtc” sip:180@1.1.1.1;tag=4e025e03-5b8d-431e-bf28-e42fce3706a5

The from Header is not changing to the Callerid(num) being set in the dial plan.


DTMF Blind transfer:
Channel PJSIP/180-00075261: Started DTMF blind transfer

set-outcallerid:4] Set(“PJSIP/vc1”, “CALLERID(num)=27123456789”) in new stack

trunk:16] Dial(“PJSIP/vc1”, “PJSIP/0123456789@vc2,300,Tr”) in new stack

PJSIP Debug:
From: “JustToTest” sip:27123456789@1.1.1.1;tag=8bbb0beb-bad4-40d5-a1de-34291b28c396

The system is designed to have different Callerid(num) based on the extension making the calls.
exp:
180 has outbound callerid 0123456789
181 has outbound callerid 0987654321

Edit:
FYI, this works perfectly fine with SIP transfers using Yealink. The correct Callerid reflects, this is only isolated to DTMF attendant transfer.
The client is using a 3de party system using WebRTC and they can only do DTMF transfers.

I’m facing the same trouble. See my post here:

I tried all suggested changes from my thread without success.
I believe this is a bug. I just did not find time to report this in Asterisk github.

Features attended transfers differ from SIP one is that they provide original caller’s caller ID, rather than the transferor’s. At a guess that is being done as a hack at a very late stage in the call setup.

So best advise here will be log it on the bug tracker.

I will have to get the SIP provider to force a Callerid on all calls.

Busy with future testing:

Asterisk 20.5.2 - Server 1
extensions.conf

[extensions]
exten => _2X.,1,Gosub(trunk,s,1(${EXTEN}))
exten => _0X.,1,Gosub(trunk,s,1(${EXTEN}))

exten => 0111111111,1,Gosub(trunk2,s,1(${EXTEN}))

[trunk]
exten => s,1,Set(CALLERID(num)=44444444)
exten => s,n,Dial(PJSIP/${ARG1}@mytrunk,300,T)
exten => s,n,Busy

[trunk2]
exten => s,1,Set(CALLERID(num)=44444444)
exten => s,n,Dial(PJSIP/${ARG1}@mytrunk2,300,T)
exten => s,n,Busy

[inbound]
exten => 9876543210,1,Answer
exten => 9876543210,n,NoOp(${CALLERID(num)})
exten => 9876543210,n,Echo()

pjsip.conf

[simpletrans]
type=transport
protocol=udp
bind=0.0.0.0

;===============Trunk

[201]
type=endpoint
context=extensions
disallow=all
allow=ulaw
auth=auth201
aors=201
callerid="Exten 201" <201>
direct_media=false
disable_direct_media_on_nat=true
mailboxes=201
named_call_group=1
named_pickup_group=1
rtp_symmetric=true
rewrite_contact=true
tos_audio=184
tos_video=184
transport=simpletrans

[auth201]
type=auth
auth_type=userpass
password=201
username=201

[201]
type=aor
max_contacts=1
qualify_frequency=5

[mytrunk]
type=endpoint
context=inbound
disallow=all
allow=ulaw
auth=authmytrunk
aors=mytrunk
tos_audio=184
tos_video=184
transport=transport-udp
direct_media=false
disable_direct_media_on_nat=true
mailboxes=mytrunk
named_call_group=mytrunk
named_pickup_group=mytrunk
rewrite_contact=true
rtp_keepalive=30
rtp_symmetric=true
rtp_timeout=30
rtp_timeout_hold=300
tos_audio=184
tos_video=184
transport=simpletrans

[authmytrunk]
type=auth
auth_type=userpass
password=password
username=mytrunk

[mytrunk]
type=aor
max_contacts=1
qualify_frequency=5

Server 1 with endpoint 201 phones Server 2.


Asterisk 20.5.2 - Server 2
extensions.conf

[extensions]
exten => _0X.,1,Gosub(trunk,s,1(${EXTEN}))
exten => _9X.,1,Gosub(trunk,s,1(${EXTEN}))

[trunk]
exten => s,1,Set(CALLERID(num)=8888888888)
exten => s,n,Dial(PJSIP/${ARG1}@mytrunk,300,T)
exten => s,n,Busy

[inbound]
exten => 0123456789,1,Answer
exten => 0123456789,n,NoOp(${CALLERID(num)})
exten => 0123456789,n,Queue(reception,tTi,,,,,,,,)

pjsip.conf

;===============TRANSPORT

[simpletrans]
type=transport
protocol=udp
bind=0.0.0.0

;===============EXTENSION 200

[200]
type=endpoint
context=extensions
disallow=all
allow=ulaw
auth=auth200
aors=200
callerid="Exten 200" <200>
direct_media=false
disable_direct_media_on_nat=true
mailboxes=200
named_call_group=1
named_pickup_group=1
rtp_symmetric=true
rewrite_contact=true
tos_audio=184
tos_video=184
transport=simpletrans

[auth200]
type=auth
auth_type=userpass
password=200
username=200

[200]
type=aor
max_contacts=10
qualify_frequency=5


;===============TRUNK

[mytrunk]
type=registration
outbound_auth=mytrunk
server_uri=sip:192.168.50.136
client_uri=sip:mytrunk@192.168.50.136
retry_interval=60
max_retries=150
fatal_retry_interval=150
auth_rejection_permanent=no
forbidden_retry_interval=60
contact_user=mytrunk

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

[mytrunk]
type=aor
contact=sip:192.168.50.136:5060
qualify_frequency=5

[mytrunk]
type=endpoint
context=inbound
disallow=all
allow=ulaw
outbound_auth=mytrunk
aors=mytrunk
contact_user=mytrunk

[mytrunk]
type=identify
endpoint=mytrunk
match=192.168.50.136

Server 2 with endpoint 200 receives call in Queue and DTMF attendant transfer call back to Server 1.


This looks like it working, Server 1 phones server 2 with Callerid(num)=44444444, Server 2 transfers call back to Server 1 with Caller(num)=8888888888

Server 1 trunk is just broken and not accepting the call:
localhost*CLI> [Jan 5 11:23:19] NOTICE[138332]: res_pjsip/pjsip_distributor.c:676 log_failed_request: Request 'INVITE' from '"Exten 200" <sip:8888888888@192.168.50.14>' failed for '192.168.50.14:5060' (callid: 6cae183e-9a3b-4f85-b97f-59e314253211) - No matching endpoint found


My dial plan and Real time endpoint still aren’t working.

I am 99% sure this is related to System Application being called after the Callerid(num) is being set. I have done around 40
tests to identify the cause.

Below code breaks Callerid(num)

[extensions]
exten => _0X.,1,Gosub(trunk,s,1(${EXTEN}))
exten => _9X.,1,Gosub(trunk,s,1(${EXTEN}))

[set-outcallerid]
    exten => s,1,ExecIf($[${LEN(${CFEXT})}=0]?Set(EXT=${CALLERID(num)}))
    exten => s,n,Execif($[$[${LEN(${callerid})}=0] | $["${callerid}"="NULL"]]?SET(mycallerid=${EXT}))
    exten => s,n,Set(CALLERID(num)=6666666)
    exten => s,n,Return()

[trunk]
    exten => s,1,Gosub(set-outcallerid,s,1)
    exten => s,n,System(echo "${EPOCH}|${UNIQUEID}|${QUEUE_OUT}|${AGENT}|CALLOUTBOUND||${ARG1}" >> /var/log/asterisk/queue_log)
    exten => s,n,Dial(PJSIP/${ARG1}@mytrunk,300,T)
    exten => s,n,Busy

Calling the System Application before Callerid(num) is set, cause it to be intermittent.

‘INVITE’ from ‘“Exten 200” sip:200@192.168.50.14

‘INVITE’ from ‘“Exten 200” sip:6666666@192.168.50.14

Removing the System Application and reloading the dial plan causes the first call the have the wrong Callerid(num). The calls that followed have the callerid(num) set.


Some more testing and NoOp seems to have to same affect as System, it break Callerid(num) being set in the dial plan.

[extensions]
exten => _0X.,1,Gosub(trunk,s,1(${EXTEN}))
exten => _9X.,1,Gosub(trunk,s,1(${EXTEN}))

[set-outcallerid]
    exten => s,1,ExecIf($[${LEN(${CFEXT})}=0]?Set(EXT=${CALLERID(num)}))
    exten => s,n,Execif($[$[${LEN(${callerid})}=0] | $["${callerid}"="NULL"]]?SET(mycallerid=${EXT}))
    exten => s,n,Set(CALLERID(num)=6666666)
    exten => s,n,Return()

[trunk]
    exten => s,1,NoOp()
    exten => s,n,Gosub(set-outcallerid,s,1)
    exten => s,n,Dial(PJSIP/${ARG1}@mytrunk,300,T)
    exten => s,n,Busy

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