Call Files and local channel

Hi,

I trying to setup asterisk alarm calling with nagios following the example

For some reason I don’t get the playout and call is disconnected after B-party picks up the phone. There is an error that I don’t understand as the call gets connected:

Call failed to go through, reason (3) Remote end Ringing

#!/bin/bash
channel=$1
alarmtext=$2
alarmid=$3

#cd /var/spool/alarm
#echo $alarmtext > alarm$alarmid.txt
#/opt/swift/usr/bin/swift -n Allison-8KHz -f alarm$alarmid.txt -o alarm$alarmid.tmp.wav
#/usr/bin/sox alarm$alarmid.tmp.wav -r 8000 alarm$alarmid.ul
#/bin/mv -f alarm$alarmid.ul alarm$alarmid.ulaw
#/bin/rm alarm$alarmid.tmp.wav

echo "Channel: $1
MaxRetries: 2
RetryTime: 60
WaitTime: 30
CallerID: +496920009090
Context: alarmdialout
Extension: s
Priority: 1
Set: alarmid=$alarmid" > /tmp/alarm$alarmid.call

/bin/chmod 777 /tmp/alarm$alarmid.call
/bin/mv /tmp/alarm$alarmid.call /var/spool/asterisk/outgoing

[add-p-pref]
exten => _+X.,1,Set(PJSIP_HEADER(add,P-Preferred-Identity)=<sip:${EXTEN}@sip.test.com\;user=phone>)
    same => n,Return

[alarmdialout_bann]
exten => s,1,NoOp()
    same => n,Set(CHANNEL(language)=de)
    same => n,Wait(1)
    same => n,Read(ZERO,press-0,1,,,10)
    same => n,GotoIf($[$["${ZERO}" != "0"]]?dialout-end)
;    same => n,Playback(/var/spool/alarm/alarm${alarmid})
    same => n,Return()
    same => n(dialout-end),SoftHangup(${ARG1})
    same => n,Return()

[alarmdialout]
exten => s,1,NoOp()
    same => n,Dial(PJSIP/test/sip:+123456789@sip.test.com,,b(add-p-pref^+987654321^1)U(alarmdialout_bann^${CHANNEL(name)}))

 PJSIP/test-00000002 Internal Gosub(alarmdialout_bann,s,1(Local/s@alarmdialout-00000002;2)) start
    -- Executing [s@alarmdialout_bann:1] NoOp("PJSIP/test-00000002", "") in new stack
    -- Executing [s@alarmdialout_bann:2] Set("PJSIP/test-00000002", "CHANNEL(language)=de") in new stack
    -- Executing [s@alarmdialout_bann:3] Wait("PJSIP/test-00000002", "1") in new stack
    -- Executing [s@alarmdialout_bann:4] Read("PJSIP/test-00000002", "ZERO,press-0,1,,,10") in new stack
    -- Accepting a maximum of 1 digits.
    -- <PJSIP/test-00000002> Playing 'press-0.alaw' (language 'de')
[Nov  4 12:34:10] WARNING[5131]: pbx_spool.c:353 safe_append: Unable to set utime on /var/spool/asterisk/outgoing/alarmtest_id_1.call: Operation not permitted
[Nov  4 12:34:10] NOTICE[9592]: pbx_spool.c:450 attempt_thread: Call failed to go through, reason (3) Remote end Ringing
[Nov  4 12:34:10] NOTICE[9592]: pbx_spool.c:453 attempt_thread: Queued call to local/s@alarmdialout expired without completion after 2 attempts
    -- User entered nothing.
    -- Executing [s@alarmdialout_bann:5] GotoIf("PJSIP/test-00000002", "1?dialout-end") in new stack
    -- Goto (alarmdialout_bann,s,7)
    -- Executing [s@alarmdialout_bann:7] SoftHangup("PJSIP/test-00000002", "Local/s@alarmdialout-00000002;2") in new stack
[Nov  4 12:34:11] WARNING[9593][C-00000003]: app_softhangup.c:120 softhangup_exec: Soft hanging Local/s@alarmdialout-00000002;2 up.
    -- Executing [s@alarmdialout_bann:8] Return("PJSIP/test-00000002", "") in new stack