Hi all, I am a user to make IVR system using Asterisk and EAGI.
Our system should handle SIP Headers, so we’ve using SIP_HEADER function at our dialplan like below.
[handle-header]
exten = _X.,1,Set(MyHeader=${SIP_HEADER(X-My-Header)})
same = _X.,1,Set(OtherHeader=${SIP_HEADER(X-Other-Header)})
same = _X.,1,Set(AnotherHeader=${SIP_HEADER(X-Another-Header)})
; our service
exten = _X,1,Answer()
same = n,Gosub(handle-header,s,1)
same = n,EAGI(/path/to/our/eagi_script.agi,${MyHeader},${OtherHeader},${AnotherHeader})
Recently, we are planning to add several more headers to handle.
It is expected that the number of arguments to the program will increase considerably.
So, I want to know more smart way to pass multipe SIP headers to EAGI program.
SIP_HEADER only works with the no longer supported (and no longer included in the latest release) chan_sip. You should be using chan_pjsip, which handles headers (particularly setting them) differently. Also note that doing it the way you are doing it makes it vulnerable to code injection attacks.
AGI can read channel variables, and the results of function calls (in the same way), so the AGI can invoke PJSIP_HEADER directly for the reads (writes are rather more different, as they have to be done on the B side channel, after it has been created).