Stremovskyy
Stremovskyy

Reputation: 502

PJSIP adding custom header to Queue

I trying to add custom information to INVITE packet which will received by front with WebRTC. On Asterisk this data generated before dial and placed in EXTEN var.

most simple way to transport this data is adding custom header to channel before dialing.

In regular dial I need to

same => n,Set(PJSIP_HEADER(add,X-Custom-Header)=${EXTEN})

PJSIP_HEADER needed channel for work, but in queue I don’t have it.

now extension like

[testing-in]
    exten => _XXX.,1,Noop(queue test call)
    same => n,Answer
    same => n,Ringing
    same => n,Wait(2)
    ;Need to add custom header here
    same => n,Queue(testing-operators)
    same => n,Hangup

All operators in queue need to receive this custom header while ringing

Upvotes: 1

Views: 2403

Answers (3)

codingb
codingb

Reputation: 54

When you execute the Queue command, you can use Queue options to provide instructions to be executed in the initiated outgoing call. Following snippet would add header x = y.

exten => _XXX,1,NoOp(Add header to outgoing call in the queue)
same => n,Queue(queuename, b(ADD_HEADER^s^1))

[ADD_HEADER]
exten => s,1,Set(PJSIP_HEADER(x)=y))

Upvotes: 2

Stremovskyy
Stremovskyy

Reputation: 502

Now I inject some useful for me information into Caller Name

[test-in]
exten => _XXX.,1,GoSub(recording,s,1,(${CALLERID(num)},${EXTEN}))
same => n,Noop(test-in call)
same => n,Answer
same => n,Set(CALLERID(name)=${EXTEN})
same => n,Queue(test-operators,Tt,,120)
same => n,Hangup

And parse it on frontend application It’s worked for me

Upvotes: 0

arheops
arheops

Reputation: 15259

it is Not so easy. You can put variable which will be in queue by using two underscores:

;Need to add custom header here
same => n,Set(__ADD_NEW_HEADER=1)
same => n,Queue(testing-operators)

After that you can add agents via Local/ channels(see how it is in FreePBX) and add headers for each call out(in freepbx it will be from-queue context)

Upvotes: 0

Related Questions