Схема: GSM-шлюз, 2е симки, каждая звонит на свой номер.
Код: Выделить всё
[holidays]
exten => 201,1,Answer()
exten => 201,n,Macro(recording,${CALLERID(num)},${EXTEN})
exten => 201,n,Dial(SIP/200&SIP/201&SIP/sipnet.ru/номер,1,tTm(manual))
exten => 201,n,GotoIf($["${DIALSTATUS}" = "NOANSWER"]?:7)
exten => 201,n,GotoIf($["${DIALSTATUS}" = "BUSY"]?:7)
exten => 201,n,Hangup
exten => XXX,n,Goto(send_mail,s,1)
exten => 200,1,Answer()
exten => 200,n,Playback(/music_for_ats/Welcome)
exten => 200,n,Playback(/music_for_ats/Razgovor_zapisan)
exten => 200,n,Macro(recording,${CALLERID(num)},${EXTEN})
exten => 200,n,Dial(SIP/200&SIP/201&SIP/sipnet.ru/номер,60,tTm(manual))
exten => 200,n,GotoIf($["${DIALSTATUS}" = "NOANSWER"]?:7)
exten => 200,n,GotoIf($["${DIALSTATUS}" = "BUSY"]?:7)
exten => 200,n,Hangup
[send_mail]
exten => s,1,System(rm /records/body.txt)
exten => s,n,System(echo "${CALLERID(num)}" "${DIALSTATUS}" "${VMSTATUS}" >> /records/body.txt)
exten => s,n,System(/records/send_mail.sh "${CALLERID(num)}" "${STRFTIME(${EPOCH},,%Y-%m-%d/%H:%M)}" "${DIALSTATUS}" "${VMSTATUS}")
exten => s,n,Hangup