[asterisk-users] PJSIP add header on forwarded call

Administrator TOOTAI admin at tootai.net
Tue Nov 27 03:49:57 CST 2018

Hi list,

to manage an external queue agent the only solution I found is to 
connect a local account and redirect calls to this account using forward 
features from the phone (SNOM). The problem I face is that before 
calling the agent I would like to set extra header. Dialplan to call 
external agent is this one with (Gosub):

; Call our gateway

exten = s,1,Set(PJSIP_HEADER(add,X-TOOTAiAudio-CALLED)=${ARG1})
  same = n,Dial(PJSIP/${ARG1}@TOOTAiAudio,,T)
  same = n,Return

exten = h,1,NoOp()
  same = n,NoOp(Hangup Cause: ${HANGUPCAUSE})
  same = n,NoOp(Dial status : ${DIALSTATUS})
  same = n,NoOp(X-TOOTAiAudio=${PJSIP_HEADER(read,X-TOOTAiAudio-CALLED)})
  same = n,Return

When a local phone call extension 115 (the one where calls to external 
agent are forwarded), everything is working well. But if I call the 
account from a queue I get

[Nov 27 09:54:08] ERROR[12758][C-0000005f]: res_pjsip_header_funcs.c:513 
func_write_header: This function requires a PJSIP channel

Output of queue is

deblix9*CLI> queue show q301
q301 has 0 calls (max unlimited) in 'ringall' strategy (6s holdtime, 47s 
talktime), W:0, C:25, A:3, SL:100.0%, SL2:100.0% within 60s
       PJSIP/PPermis115 (ringinuse disabled) (dynamic) (Not in use) has 
taken 8 calls (last was 706 secs ago)
    No Callers

where PPermis115 is the local account on a phone who forward calls to 
extension 115.

Why can't be PJSIP extra headers setted in this case ?

Thanks for any hint



More information about the asterisk-users mailing list