Hi everyone,
I am calling from Twilio to asterisk like this:
<?xml version="1.0" encoding="UTF-8"?> sip:xx.xx.68.27?X-languageId=293I need to receive that call, and that part is working fine.
After that, I need to dial a third-party SIP, which is also working. The call goes to the third party correctly.
Here is my dialplan snippet:
[from-twilio]
exten => s,1,NoOp(— REFER RECEIVED —)
same => n,Set(REFER_TO=${PJSIP_HEADER(read,Refer-To)})
same => n,NoOp(Refer-To header: ${REFER_TO})
; Extract the portion after ‘X-languageId=’
same => n,Set(LANG_PARAM=${CUT(REFER_TO, X-languageId=, 2)})
; LANG_PARAM now contains ‘293>’ or more, so strip trailing chars
same => n,Set(LANGUAGE_FROM_ID=${CUT(LANG_PARAM, >, 1)})
same => n,NoOp(Extracted X-languageId: ${LANGUAGE_FROM_ID})
same => n,Goto(thirdparty-backup,s,1)
The issue is I am unable to read the URI parameters sent from Twilio. I need to read the parameter from Twilio and pass it to the third party.
If I pass a static parameter hardcoded, it works fine, but I want to pass the language parameter from Twilio to the third party dynamically.
Here are some relevant log lines showing empty variables:
Set(“PJSIP/twilio0-00000217”, “REFER_TO=”) in new stack
NoOp(“PJSIP/twilio0-00000217”, "Refer-To header: ") in new stack
Set(“PJSIP/twilio0-00000217”, “LANG_PARAM=”) in new stack
Set(“PJSIP/twilio0-00000217”, “LANGUAGE_FROM_ID=”) in new stack
NoOp(“PJSIP/twilio0-00000217”, "Extracted X-languageId: ") in new stack
Goto(“PJSIP/twilio0-00000217”, “thirdparty-backup,s,1”) in new stack
NoOp(“PJSIP/twilio0-00000217”, “— THIRD PARTY BACKUP CALL STARTED —”) in new stack