Asterisk MWI with CUCM integration not working

Hello All,

I am using Asterisk 11.17.1/Freepbx as voicemail server for Cisco phones that I have registered to Cisco Call Manager. I have SIP trunk between CUCM and Freepbx and i am successfully able to leave and retrieve voice messages for the Cisco phone registered to CUCM. However, the MWI part is still not working. I configured the script for MWI from the link and I have specified the file name in externnotify under voicemail.conf. But its still not working. When I try to run the script manually by doing ./, I get below warnings on the asterisk cli.

[2017-07-19 17:48:23] WARNING[3206]: pbx_spool.c:289 apply_outgoing: At least one of app or extension must be specified, along with tech and dest in file /var/spool/asterisk/outgoing/.call
[2017-07-19 17:48:23] WARNING[3206]: pbx_spool.c:456 scan_service: Invalid file contents in /var/spool/asterisk/outgoing/.call, deleting

My script looks like below:

Turnoff=“Channel: SIP/28888@FromToGBG-CUCM\nCallerid: $EXTEN\nMaxRetries: 0\nRetryTime: 5\nWaitTime: 5\nContext: $CONTEXT\nExtension: $EXTEN”

Turnon=“Channel: SIP/28889@FromToGBG-CUCM\nCallerid: $EXTEN\nMaxRetries: 0\nRetryTime: 5\nWaitTime: 5\nContext: $CONTEXT\nExtension: $EXTEN”

if [[ $NUMVMS = “0” ]]; then
echo -e $Turnoff >> /var/spool/asterisk/outgoing/$
echo -e $Turnon >> /var/spool/asterisk/outgoing/$

Also when I try to run the channel command ( echo -e Channel: SIP/28889@FromToGBG-CUCM\nCallerid: 1205\nMaxRetries: 0\nRetryTime: 5\nWaitTime: 5\nContext: default\nExtension: 1205 >> /var/spool/asterisk/outgoing/$ from the CLI it gives me same errors, as if the script is not getting the variable values from asterisk.

Can someone please help me how I can make MWI working for the phones registered to CUCM?

Other information:

Phone is configured as “custom” extension in asterisk.
I have MWI extensions (28888 and 288889) configured in CUCM.
I dont see asterisk trying to make a call to CUCM for MWI extensions when a message is left on voicemail.