Shell Command Failing

Trying to run this Shell command to get the domain from the from SIP header:
exten => s,n,Set(UWIPDEST=${SHELL(${SIP_HEADER(From)} | sed -e 's/;.*//' | grep -q "@domain.com" && echo "555.555.555.555" || echo "666.666.666.666")})

39876	[2024-07-08 16:22:50] WARNING[1162][C-000a9f74] pbx_variables.c: Error in extension logic (missing '}')	
39877	[2024-07-08 16:22:50] WARNING[1162][C-000a9f74] pbx_variables.c: Error in extension logic (missing '}')	
39878	[2024-07-08 16:22:50] WARNING[1162][C-000a9f74] pbx_functions.c: Can't find trailing parenthesis for function 'SIP_HEADER(From'?	
39879	[2024-07-08 16:22:50] WARNING[1162][C-000a9f74] pbx_functions.c: Can't find trailing parenthesis for function 'SHELL("Doe, John" <sip:5555555555@domain.com>;tag=519e66763d4641ef821705056ba958f'?

I think maybe the issue is because there is a semicolon in the from header, but I am not sure? All I am really trying to do is see is if the from header contains ‘@domain.com’ if it does contain @domain.com, then make the variable ${UWIPDEST} 555.555.555.555, otherwise make the variable 666.666.666.666.

What am I missing to make this work?

This solved it.
ExecIf($["${REGEX("domain[.]com" ${PJSIP_HEADER(read,From)})}" == "1"]?Set(UWIPDEST="555.555.555.555"):Set(UWIPDEST="666.666.666.666"))

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