Paging In Waves.

Home » Asterisk Users » Paging In Waves.
Asterisk Users 1 Comment

I’ve been working on writing a subroutine to page groups of phones at once and I’m having some difficulty.

My goal is to have a user call an extension, I record the page they wish to play, I then page out that recorded file to the phones in groups.

[sub-masspage]
exten => s,1,NoOP
same => n,Answer same => n,Set(filename=$PAGE)
same => n,Wait(1)
same => n,Record(pagequeue/${filename}%d.gsm,0,30,yk)
same =>
n,Set(DURATION=$[CEIL(${STAT(s,/var/lib/asterisk/sounds/${RECORDED_FILE}.gsm)}
/ 1650)])
same => n,Playback(one-moment-please)
same => n,Set(MUTEAUDIO(all)=on)
same => n,SIPAddHeader(Alert-Info: RingAnswer)
same => n,SipAddHeader(Call-Info: \;answer-after=0)
;same => n,Set(TIMEOUT(absolute)=${DURATION})
same =>
n,ExecIf($[${ISNULL(${ARG1})}=0]?Page(${ARG1},n(${RECORDED_FILE})is),10)
same =>
n,ExecIf($[${ISNULL(${ARG2})}=0]?Page(${ARG2},n(${RECORDED_FILE})is),10)
same =>
n,ExecIf($[${ISNULL(${ARG3})}=0]?Page(${ARG3},n(${RECORDED_FILE})is),10)
same =>
n,ExecIf($[${ISNULL(${ARG4})}=0]?Page(${ARG4},n(${RECORDED_FILE})is),10)
same =>
n,ExecIf($[${ISNULL(${ARG5})}=0]?Page(${ARG5},n(${RECORDED_FILE})is),10)
same =>
n,ExecIf($[${ISNULL(${ARG6})}=0]?Page(${ARG6},n(${RECORDED_FILE})is),10)
same =>
n,ExecIf($[${ISNULL(${ARG7})}=0]?Page(${ARG7},n(${RECORDED_FILE})is),10)
same =>
n,ExecIf($[${ISNULL(${ARG8})}=0]?Page(${ARG8},n(${RECORDED_FILE})is),10)
same =>
n,ExecIf($[${ISNULL(${ARG9})}=0]?Page(${ARG9},n(${RECORDED_FILE})is),10)
same =>
n,ExecIf($[${ISNULL(${ARG10})}=0]?Page(${ARG10},n(${RECORDED_FILE})is)10)
same => n,Set(MUTEAUDIO(all)=off)
same => n,Playback(goodbye)
same => n,TrySystem(rm -f /var/lib/asterisk/sounds/${RECORDED_FILE}.gsm)
same => n,Hangup
;end sub-masspage

The issue I’m having is the Page command is putting the phone that’s doing the paging into the meetme bridge it’s creating and the dialplan stops at the first Page command.

While I was testing it with a single phone I was using Dial instead of Page

same =>
n,ExecIf($[${ISNULL(${ARG1})}=0]?Dial(${ARG1},15,A(${RECORDED_FILE})S(${DURATION})mg)
))
same =>
n,ExecIf($[${ISNULL(${ARG2})}=0]?Dial(${ARG2},15,A(${RECORDED_FILE})S(${DURATION})mg)))

Which worked great when I sent it one phone in each argument.. Didn’t think about the fact that the first phone that answers is the only phone that answers till I got deeper into writing it… (It’s been a long day)

So I’m at a loss as what to do here, Dial almost does what I need other than the fact that the first phone that answers is the only phone that bridges, and Page almost does what I need other than my dialplan execution stops after the first Page command and it’s trying to include the phone I’m calling from as one of the phones it’s paging.

I’m using 1.8 so I’ve got Meetme and Confbridge available but I’m not sure what to do unless I start playing with LOCAL channels. Maybe I could have PAGE call Local Channels that have the TIMEOUT set but then I’d need a way to pass which phones to dial in somehow.

Suggestions?

One thought on - Paging In Waves.

  • I wanted to follow up that I had solved my issue to my satisfaction and share the dialplan that did so.

    [sub-masspage]
    exten => s,1,NoOP
    same => n,Answer same => n,Set(filename=PAGE)
    same => n,Wait(1)
    same => n,Record(pagequeue/${filename}%d.gsm,0,60,yk)
    same =>
    n,Set(DURATION=$[CEIL(${STAT(s,/var/lib/asterisk/sounds/${RECORDED_FILE}.gsm)}
    / 1650)])
    same => n,Playback(one-moment-please)
    same => n,SIPAddHeader(Alert-Info: RingAnswer)
    same => n,SipAddHeader(Call-Info: \;answer-after=0); Yealink same => n,ExecIf($[${ISNULL(${ARG1})}=0]?Dial(LOCAL/GO$[${DURATION}
    +2]@sub-masspage,5,U(sub-pageit^${ARG1}^${RECORDED_FILE})gm)))
    same => n,ExecIf($[${ISNULL(${ARG2})}=0]?Dial(LOCAL/GO$[${DURATION}
    +2]@sub-masspage,5,U(sub-pageit^${ARG2}^${RECORDED_FILE})gm)))
    same => n,ExecIf($[${ISNULL(${ARG3})}=0]?Dial(LOCAL/GO$[${DURATION}
    +2]@sub-masspage,5,U(sub-pageit^${ARG3}^${RECORDED_FILE})gm)))
    same => n,ExecIf($[${ISNULL(${ARG4})}=0]?Dial(LOCAL/GO$[${DURATION}
    +2]@sub-masspage,5,U(sub-pageit^${ARG4}^${RECORDED_FILE})gm)))
    same => n,ExecIf($[${ISNULL(${ARG5})}=0]?Dial(LOCAL/GO$[${DURATION}
    +2]@sub-masspage,5,U(sub-pageit^${ARG5}^${RECORDED_FILE})gm)))
    same => n,ExecIf($[${ISNULL(${ARG6})}=0]?Dial(LOCAL/GO$[${DURATION}
    +2]@sub-masspage,5,U(sub-pageit^${ARG6}^${RECORDED_FILE})gm)))
    same => n,ExecIf($[${ISNULL(${ARG7})}=0]?Dial(LOCAL/GO$[${DURATION}
    +2]@sub-masspage,5,U(sub-pageit^${ARG7}^${RECORDED_FILE})gm)))
    same => n,ExecIf($[${ISNULL(${ARG8})}=0]?Dial(LOCAL/GO$[${DURATION}
    +2]@sub-masspage,5,U(sub-pageit^${ARG8}^${RECORDED_FILE})gm)))
    same => n,ExecIf($[${ISNULL(${ARG9})}=0]?Dial(LOCAL/GO$[${DURATION}
    +2]@sub-masspage,5,U(sub-pageit^${ARG9}^${RECORDED_FILE})gm)))
    same => n,ExecIf($[${ISNULL(${ARG10})}=0]?Dial(LOCAL/GO$[${DURATION}
    +2]@sub-masspage,5,U(sub-pageit^${ARG10}^${RECORDED_FILE})gm)))
    same => n,Playback(auth-thankyou&goodbye)
    same => n,TrySystem(rm -f /var/lib/asterisk/sounds/${RECORDED_FILE}.gsm)
    same => n,Hangup

    exten => _GO[0-9][0-9],1,NoOP
    same => n,Answer same => n,Wait(${EXTEN:-2})
    same => n,Hangup

    exten => _GO[0-9],1,NoOP
    same => n,Answer same => n,Wait(${EXTEN:-1})
    same => n,Hangup

    [sub-pageit]
    exten => s,1,NoOP
    same => n,Set(CALLERID(NAME)=PAGE)
    same => n,Set(CALLERID(NUM)=PAGE)
    same => n,Page(${ARG1},A(${ARG2})is),10)
    same => n,Hangup

    ;end sub-masspage