Wiebe Cazemier
2015-Nov-04 16:24 UTC
[asterisk-users] Find me macro - calling multiple people to get a hold of one
Hi list, We're trying to set up a phone number that customers can call to get a hold of anyone of a group of sysadmins (and not their voice mails!). We found the findme example ([1]) that makes the callees press 1 to accept the call. It almost works, but it doesn't work correctly when one of the callees, the sysadmins, hangs up after accepting the call. We're using this 'screen' macro: =============================[default] exten => _9999XXXXXXXXXX,1,Dial(SIP/bla/${EXTEN:4},40,M(screen)) exten => _9999XXXXXXXXXX,2,Hangup [macro-screen] exten => s,1,Wait(1) exten => s,n,Background(press-1) exten => s,n,WaitExten(10) ; the value is the Wait time before we assume the call is not accepted exten => 1,1,NoOp(Caller accepted) ; Do not set MACRO_RESULT to anything to connect the caller exten => t,1,Playback(weasels-eaten-phonesys) ; if you're too late with pressing 1 exten => t,n,Set(MACRO_RESULT=CONTINUE) [findme] exten => s,1,Set(CALLERID(all)="Alarm" <911>) same => n,Playback(please-wait-connect-oncall-eng) same => n,Dial(LOCAL/9999${WIEBE_MOBILE}) same => n,Playback(vm-nobodyavail) exten => t,1,Playback(vm-nobodyavail) ============================ First of all, what is MACRO_RESULT? I can't seem to find anything about that. Googling for it yields basically nothing. But the biggest problem is when the callee answers, then hangs up. The person calling is connected to the phone that hangs up, instead of hearing 'vm-nobodyavail'. This seems to be because there is nothing that sets MACRO_RESULT in that event (it's only set on 't', timeout). I tried adding: exten => h,1,Verbose(0,"The callee hung up") exten => h,n,Set(MACRO_RESULT=CONTINUE) to handle the hangup (h), but it's not doing that. WaitExten() pushes the result back on the stack and restarts the context, right? So what is the result when the person hangs up? Regards, Wiebe [1] http://www.voip-info.org/wiki/view/Asterisk+tips+findme
jg
2015-Nov-04 16:42 UTC
[asterisk-users] Find me macro - calling multiple people to get a hold of one
> We're trying to set up a phone number that customers can call to get a hold of anyone of a group of sysadmins (and not their voice mails!). We found the findme example ([1]) that makes the callees press 1 to accept the call. It almost works, but it doesn't work correctly when one of the callees, the sysadmins, hangs up after accepting the call. > > We're using this 'screen' macro: > > =============================> [default] > exten => _9999XXXXXXXXXX,1,Dial(SIP/bla/${EXTEN:4},40,M(screen)) > exten => _9999XXXXXXXXXX,2,Hangup > > [macro-screen] > exten => s,1,Wait(1) > exten => s,n,Background(press-1) > exten => s,n,WaitExten(10) ; the value is the Wait time before we assume the call is not accepted > exten => 1,1,NoOp(Caller accepted) ; Do not set MACRO_RESULT to anything to connect the caller > exten => t,1,Playback(weasels-eaten-phonesys) ; if you're too late with pressing 1 > exten => t,n,Set(MACRO_RESULT=CONTINUE) > > [findme] > exten => s,1,Set(CALLERID(all)="Alarm" <911>) > same => n,Playback(please-wait-connect-oncall-eng) > same => n,Dial(LOCAL/9999${WIEBE_MOBILE}) > same => n,Playback(vm-nobodyavail) > exten => t,1,Playback(vm-nobodyavail) > ============================> > First of all, what is MACRO_RESULT? I can't seem to find anything about that. Googling for it yields basically nothing. > > But the biggest problem is when the callee answers, then hangs up. The person calling is connected to the phone that hangs up, instead of hearing 'vm-nobodyavail'. This seems to be because there is nothing that sets MACRO_RESULT in that event (it's only set on 't', timeout). > > I tried adding: > > exten => h,1,Verbose(0,"The callee hung up") > exten => h,n,Set(MACRO_RESULT=CONTINUE) > > to handle the hangup (h), but it's not doing that. > > WaitExten() pushes the result back on the stack and restarts the context, right? So what is the result when the person hangs up? > > Regards, > > Wiebe >Sorry, but why is a simple Dial(SIP/A&SIP/B&...,${CALLTIMEOUT},${DIALOPTS}) ... Hangup() not acceptable? If necessary, one can try to find out which devices are technically available to avoid dialing a non-existent device. If pressing a "1" is acceptable, then why not pressing the "DND" to not accept the call? jg There's
Wiebe Cazemier
2015-Nov-04 18:36 UTC
[asterisk-users] Find me macro - calling multiple people to get a hold of one
----- Original Message -----> From: "jg" <webaccounts173 at jgoettgens.de> > To: "Asterisk Users Mailing List - Non-Commercial Discussion" <asterisk-users at lists.digium.com> > Sent: Wednesday, 4 November, 2015 5:42:17 PM > Subject: Re: [asterisk-users] Find me macro - calling multiple people to get a hold of one > > > Sorry, but why is a simple > > Dial(SIP/A&SIP/B&...,${CALLTIMEOUT},${DIALOPTS}) > ... > Hangup() > > not acceptable? If necessary, one can try to find out which devices are > technically available to > avoid dialing a non-existent device. If pressing a "1" is acceptable, then > why not pressing the > "DND" to not accept the call?Because when somebody has their phone off, the caller gets a voicemail immediately.
Wiebe Cazemier
2015-Nov-06 09:54 UTC
[asterisk-users] Find me macro - calling multiple people to get a hold of one
----- Original Message -----> From: "Wiebe Cazemier" <wiebe at halfgaar.net> > To: asterisk-users at lists.digium.com > Sent: Wednesday, 4 November, 2015 5:24:38 PM > Subject: [asterisk-users] Find me macro - calling multiple people to get a hold of one > > Hi list, > > We're trying to set up a phone number that customers can call to get a hold > of anyone of a group of sysadmins (and not their voice mails!). We found the > findme example ([1]) that makes the callees press 1 to accept the call. It > almost works, but it doesn't work correctly when one of the callees, the > sysadmins, hangs up after accepting the call. > > We're using this 'screen' macro: > > =============================> [default] > exten => _9999XXXXXXXXXX,1,Dial(SIP/bla/${EXTEN:4},40,M(screen)) > exten => _9999XXXXXXXXXX,2,Hangup > > [macro-screen] > exten => s,1,Wait(1) > exten => s,n,Background(press-1) > exten => s,n,WaitExten(10) ; the value is the Wait time before we assume the > call is not accepted > exten => 1,1,NoOp(Caller accepted) ; Do not set MACRO_RESULT to anything to > connect the caller > exten => t,1,Playback(weasels-eaten-phonesys) ; if you're too late with > pressing 1 > exten => t,n,Set(MACRO_RESULT=CONTINUE) > > [findme] > exten => s,1,Set(CALLERID(all)="Alarm" <911>) > same => n,Playback(please-wait-connect-oncall-eng) > same => n,Dial(LOCAL/9999${WIEBE_MOBILE}) > same => n,Playback(vm-nobodyavail) > exten => t,1,Playback(vm-nobodyavail) > ============================> > First of all, what is MACRO_RESULT? I can't seem to find anything about that. > Googling for it yields basically nothing. > > But the biggest problem is when the callee answers, then hangs up. The person > calling is connected to the phone that hangs up, instead of hearing > 'vm-nobodyavail'. This seems to be because there is nothing that sets > MACRO_RESULT in that event (it's only set on 't', timeout). > > I tried adding: > > exten => h,1,Verbose(0,"The callee hung up") > exten => h,n,Set(MACRO_RESULT=CONTINUE) > > to handle the hangup (h), but it's not doing that. > > WaitExten() pushes the result back on the stack and restarts the context, > right? So what is the result when the person hangs up? > > Regards, > > Wiebe > > > > [1] http://www.voip-info.org/wiki/view/Asterisk+tips+findme >It appears that [1] lucked out in that it may sometimes work. WaitExten() doesn't work in a macro and has no option to supply the context it runs in. The '1' extension defined there is never called. You can use Background() instead, but you have to play something that is long enough so people have time to press a button; then you don't need WaitExten(). Background() has documented behavior with regards to macros. It calls extensions in the calling context, except if you give the context as option: exten => s,n,Background(emergency&lines-complaining-customers&press-1&press-1&press-1&press-1&press-1&press-1&press-1,,,macro-screen) But then still, more problems. The 1 and 4 extensions work, but 2 doesn't; it hangs up. I really don't get that. ==================================== exten => 1,1,Verbose(0,"1 pressed") exten => 1,n,NoOp(Caller accepted) ; Do not set MACRO_RESULT to anything to connect the caller exten => 4,1,Verbose(0,"4 pressed") exten => 4,n,NoOp(Caller accepted) ; Do not set MACRO_RESULT to anything to connect the caller ; This doesn't seem to work. It goes to hangup, in the default context exten => 2,1,Verbose(0,"2") exten => 2,n,Set(MACRO_RESULT=CONTINUE) ==================================== And I still have the problem that if I hang up instead of pressing 1, the caller gets connected to that disconnected line. There doesn't seem to be any extension I can put in my macro that responds to the hangup. Not e (exception), i (invalid), h (hangup), etc. Normally, Background() restarts the current context with the result on the stack. But when you hang up, it just SEEMS to return with a non-zero exit code, yet not continue with the 's' extension. Is it possible to make it continue with the dial plan?
Wiebe Cazemier
2015-Nov-06 16:16 UTC
[asterisk-users] Find me macro - calling multiple people to get a hold of one
----- Original Message -----> From: "Wiebe Cazemier" <wiebe at halfgaar.net> > To: "Asterisk Users Mailing List - Non-Commercial Discussion" <asterisk-users at lists.digium.com> > Sent: Friday, 6 November, 2015 10:54:48 AM > Subject: Re: [asterisk-users] Find me macro - calling multiple people to get a hold of one > > It appears that [1] lucked out in that it may sometimes work. WaitExten() > doesn't work in a macro and has no option to supply the context it runs in. > The '1' extension defined there is never called. > > You can use Background() instead, but you have to play something that is long > enough so people have time to press a button; then you don't need > WaitExten(). Background() has documented behavior with regards to macros. It > calls extensions in the calling context, except if you give the context as > option: > > exten => > s,n,Background(emergency&lines-complaining-customers&press-1&press-1&press-1&press-1&press-1&press-1&press-1,,,macro-screen) > > But then still, more problems. The 1 and 4 extensions work, but 2 doesn't; it > hangs up. I really don't get that. > > ====================================> exten => 1,1,Verbose(0,"1 pressed") > exten => 1,n,NoOp(Caller accepted) ; Do not set MACRO_RESULT to anything to > connect the caller > > exten => 4,1,Verbose(0,"4 pressed") > exten => 4,n,NoOp(Caller accepted) ; Do not set MACRO_RESULT to anything to > connect the caller > > ; This doesn't seem to work. It goes to hangup, in the default context > exten => 2,1,Verbose(0,"2") > exten => 2,n,Set(MACRO_RESULT=CONTINUE) > ====================================> > And I still have the problem that if I hang up instead of pressing 1, the > caller gets connected to that disconnected line. There doesn't seem to be > any extension I can put in my macro that responds to the hangup. Not e > (exception), i (invalid), h (hangup), etc. > > Normally, Background() restarts the current context with the result on the > stack. But when you hang up, it just SEEMS to return with a non-zero exit > code, yet not continue with the 's' extension. Is it possible to make it > continue with the dial plan?I got it working. I set the MACRO_RESULT to CONTINUE in the start extension, and then set it to something else when I don't want to connect the caller: [globals] WIEBE_MOBILE = 10digitnr ANOTHER_MOBILE = 10digitnr [default] exten => _9999XXXXXXXXXX,1,Dial(SIP/sip2phoneprovider/${EXTEN:4},40,M(screen)) exten => _9999XXXXXXXXXX,2,Hangup [macro-screen] exten => s,1,Set(MACRO_RESULT=CONTINUE) ; default action -> not connecting exten => s,n,Wait(2) exten => s,n,Background(emergency&lines-complaining-customers&press-1&press-1&press-1&press-1&press-1&press-1&press-1&press-1&press-1&press-1&press-1&press-1&press-1,,,macro-screen) exten => 1,1,Verbose(0,"1 pressed") exten => 1,n,Set(MACRO_RESULT=SANTA) [findme] exten => s,1,Set(CALLERID(all)="Bla" <123456789>) same => n,Playback(please-wait-connect-oncall-eng) same => n,Dial(LOCAL/9999${WIEBE_MOBILE}&LOCAL/9999${ANOTHER_MOBILE}) same => n,Playback(vm-nobodyavail) exten => t,1,Playback(vm-nobodyavail)