Take a look at the following. You can probably modify this to get close to
your desired behavior. ..

[default]
; My default context. For this example, must include 'ringgroups'
include = ringgroups

[inbound_default]
; Inbound calls from trunk come here. First run the check-private
; macro to look for anonymous callers exten =
s,1,Macro(check-private|${EXTEN})
; If wr come back from the macro, then call was not anonymous.
; go to where ever we would normally go. exten =
s,n,Goto(ringroups-custom-1|s|1)

[ringgroups]
; need this so that we can dial 601 and get to the ringgroup.
; this is included in [default] exten = 601,1,Goto(ringroups-custom-1,s,1)

[ringroups-custom-1]
; this is where I bring all inbound calls. They get connected to
; a local extension exten = s,1,NoOp(IncomingRing) exten =
s,n,Dial(SIP/102&SIP/110,30,${DIALOPTIONS}i)
; If no extension answers, then we fall through to here
; voicemenu-custom-3 is essentially my voicemail. exten =
s,n,Goto(voicemenu-custom-3,s,1)

[macro-check-private]
; here is where the fun starts. First compare callerID number
; with anything that could be from an anonymous caller exten =
s,1,GotoIf($["${CALLERID(num)}"=""]?unknown) exten =
s,n,GotoIf($["${CALLERID(num)}"="0000000000"]?unknown) exten =
s,n,GotoIf($["${CALLERID(num)}"="asterisk"]?unknown) exten =
s,n,GotoIf($["${CALLERID(num)}"="unknown"]?unknown) exten =
s,n,GotoIf($["${CALLERID(num)}"="Unknown"]?unknown) exten =
s,n,GotoIf($["${CALLERID(num)}"="UNKNOWN"]?unknown) exten =
s,n,GotoIf($["${CALLERID(num)}"="anonymous"]?unknown) exten =
s,n,GotoIf($["${CALLERID(num)}"="Anonymous"]?unknown) exten =
s,n,GotoIf($["${CALLERID(num)}"="ANONYMOUS"]?unknown) exten =
s,n,GotoIf($["${CALLERID(num)}"="private"]?unknown) exten =
s,n,GotoIf($["${CALLERID(num)}"="Private"]?unknown) exten =
s,n,GotoIf($["${CALLERID(num)}"="PRIVATE"]?unknown)
; Additionally I check for blacklisted numbers in the asterisk db exten =
s,n,LookupBlacklist() exten = s,n,GotoIf($["${LOOKUPBLSTATUS}" =
"FOUND"]?onblacklist)
; If we get this far then call is not anonymous and not on our blacklist
; Lookup the number in the CID database to fill in name. exten =
s,n,LookupCIDName()
; Now exit the macro... inbound call is legitimate and identified. exten =
s,n,MacroExit()
exten = s,n(onblacklist),Answer()
; If caller number is on blacklist then execute zapateller exten =
s,n,zapateller() exten = s,n,Goto(playmsg) exten = s,n(unknown),Ringing
; An anonymous caller comes here. Ring for two seconds and then answer exten
= s,n,Wait(2) exten = s,n,Answer()
; Play a message asking user to identify themselves. You need the
; asterisk extra sounds package for this macro.
; The parameter "macro-check-private" tells asterisk how to handle
; situation where caller presses a key during playback
; (jump to extension in this context) exten =
s,n(playmsg),Background(privacy-unident&vm-rec-name|m|en|macro-check-private)
exten = s,n,Wait(1) exten = s,n,Record(/tmp/asterisk-stranger:gsm|4|10)
exten = s,n,Background(priv-introsaved|m|en|macro-check-private)
; Caller has identified themselves. Now place a call to the internal
; extension that will answer the call. This is the same ringgroup that
; non anonymous callers would be sent to. Timeout is 30 seconds and
; on answering the call control passes to the "call-screen" macro
; with parameter of the file that stores caller identification. exten =
s,n,Dial(local/6...@ringgroups|30|gmM(call-screen^/tmp/asterisk-stranger))
; If we get this far then no one answered, or something else went
; wrong. If it was because of no answer then jump to a voicemenu
; with further instructions. exten =
s,n,GotoIf(S[${DIALSTATUS}=NOANSWER]?voicemenu-custom-3|s|1) exten =
s,n,Hangup
; Handle 'invalid' situations with a hangup exten =
i,1,Playback(call-terminated&goodbye) exten = i,n,Hangup
; Handle 'timeout' situations with a hangup exten =
t,1,Playback(call-terminated&goodbye) exten = t,n,Hangup
; If caller presses zero anytime during a message playback in this
; context come here. We ask them to authenticate with a password
; (123456 in this example). If they authenticate then we set a
; callerID name/number and exit the macro (continues as if call
; was not anonymous) exten = 0,1,Authenticate(123456||4) exten =
0,n,Set(CALLERID(num)=2015551212) exten = 0,n,Set(CALLERID(name)="A known
user") exten = 0,n,MacroExit() [macro-call-screen]
; If we get here then the internal extension has answered the call.
; Play back a message telling internal user that a call is pending exten =
s,1,Set(TIMEOUT(response)=5) exten =
s,n,Background(priv-callpending|m|en|macro-call-screen) exten =
s,n(repeat-screen),Background(${ARG1}|m|en|macro-call-screen) ;playback
recording callee made exten =
s,n(repeat-options),Read(ACCEPT-CALL|followme/options|1)
; Internal user must determine what to do with the call. exten =
s,n,GotoIf($["${ACCEPT-CALL}" = ""] ?t|1) ;timeout, no digit pressed exten =
s,n,GotoIf($[${ACCEPT-CALL} = 1] ?call-accepted) exten =
s,n,GotoIf($[${ACCEPT-CALL} = 2] ?call-declined:repeat-options) exten =
s,n(call-declined),Playback(privacy-thankyou)
; User declined the call. Set return action to send caller to voicemail
exten = s,n,Set(MACRO_RESULT=GOTO:voicemenu-custom-3^s^1) ;send caller to
voicemail menu exten = s,n,MacroExit()
exten = s,n(call-accepted),Playback(privacy-thankyou) exten =
s,n,MacroExit() ;call will connect on exit exten =
t,1,Playback(connection-timed-out) exten = t,n,Goto(s|call-declined) exten =
h,1,Set(MACRO_RESULT=CONTINUE) ;on hangup, continue with original dialplan
exten = h,n,MacroExit() exten = 1,1,Goto(macro-call-screen|s|call-accepted)
exten = 2,1,Goto(macro-call-screen|s|call-declined)

Hope that someone finds the above useful.  In your case, you would want to
modify the macro-call-screen to not be dependent on user action... but to,
say, automatically connect the two calls together after 10 seconds.

David


On Sun, Jan 4, 2009 at 10:18 AM, O'Connor, Brian <[email protected]>wrote:

> David -
>
> The outgoing call will be answered by another device in just a few
> seconds. However, it takes another 10-15 seconds for the legacy network
> to complete the call set-up and to establish the speech path. We want
> the message to continue for an arbitrary period to allow time to set up
> the complete speech path. (Otherwise the caller gets silence and may
> abandon the call.)
>
> I would be interested in seeing your dialplan.
>
> Thanks.
>
>   Brian
>
> -----Original Message-----
> From: [email protected] [mailto:[email protected]]
> Sent: Saturday, January 03, 2009 10:50 PM
> To: AstLinux Users Mailing List
> Subject: Re: [Astlinux-users] How do I "fork" and then "join" a call
>
>
> Will the outgoing "legacy" call answer before you join it to the
> incoming call or will it be in some other state (like ringing).
> Reason I ask is that I have a couple of macros that do almost what you
> want to implement privacy manager on my system... Esentially plays a
> please hold message until a seperately dialed line accepts the
> anonymous caller.
>
> I can post this dialplan tomorrow if you are interested
>
> David
> On 1/3/09, O'Connor, Brian <[email protected]> wrote:
> >
> > Thanks, Lonnie.
> >
> > What I need is to initiate a *separate* *outgoing* call (to the legacy
> > network) that will be joined to the parked call.
> >
> > My understanding is that a Followme() is joined by a user dialing
> *into*
> > Asterisk to meet the parked call in response to a page.
> >
> > Any ideas ?
> >
> >    Brian
> >
> > -----Original Message-----
> > From: Lonnie Abelbeck [mailto:[email protected]]
> > Sent: Saturday, January 03, 2009 12:46 PM
> > To: AstLinux Users Mailing List
> > Subject: Re: [Astlinux-users] How do I "fork" and then "join" a call
> >
> >
> >
> > On Jan 3, 2009, at 11:39 AM, O'Connor, Brian wrote:
> >
> >>
> >> I have an unusual call handling requirement, and can use some
> guidance
> >> on how to accommodate this.
> >>
> >> An incoming call needs to be forwarded to a legacy network with a
> >> *very
> >> long* set-up delay (10's of seconds). So while initiating call set-
> >> up on
> >> the outgoing path we want to play a "please hold" message to the
> >> caller.
> >> Then after a preset time we can bridge the incoming call with the
> >> outgoing call.
> >>
> >> The outgoing, slow, legacy network is a bat-phone circuit, so there
> is
> >> no need to forward dialed digits.
> >>
> >> My approach was to (1) park the incoming call in a conference and
> >> play a
> >> "please wait" message; (2) initiate the outgoing call (using a Local
> >> channel); (3) wait for outgoing call set-up delay; (4) add the
> >> outgoing
> >> call (local channel) to the incoming call in the conference. However,
> >> the dial plan won't move past step (1).
> >>
> >> FWIW, the outgoing (slow) legacy network is accessed via FXS/FXO;
> >> incoming calls are via FXS/FXO as well as VoIP.
> >>
> >> I guess I need to know how to (a) start the outgoing call while the
> >> incoming call is parked and (b) join the two calls.
> >>
> >> I'd be happy to use AGI scripts if that will do the job, but I'm not
> >> that familiar with them.
> >>
> >> Any suggestions will be welcome.
> >>
> >> Thanks.
> >>
> >>   Brian
> >
> > I would give the asterisk 1.4 Followme() app a try.
> >
> > A simple one-liner in your dialplan, and it does basically what you
> > are asking.
> >
> > Lonnie
> >
> >
> >
> >
> ------------------------------------------------------------------------
> > ------
> > _______________________________________________
> > Astlinux-users mailing list
> > [email protected]
> > https://lists.sourceforge.net/lists/listinfo/astlinux-users
> >
> > Donations to support AstLinux are graciously accepted via PayPal to
> > [email protected].
> >
> >
> ------------------------------------------------------------------------
> ------
> > _______________________________________________
> > Astlinux-users mailing list
> > [email protected]
> > https://lists.sourceforge.net/lists/listinfo/astlinux-users
> >
> > Donations to support AstLinux are graciously accepted via PayPal to
> > [email protected].
> >
> >
>
> ------------------------------------------------------------------------
> ------
> _______________________________________________
> Astlinux-users mailing list
> [email protected]
> https://lists.sourceforge.net/lists/listinfo/astlinux-users
>
> Donations to support AstLinux are graciously accepted via PayPal to
> [email protected].
>
>
> ------------------------------------------------------------------------------
> _______________________________________________
> Astlinux-users mailing list
> [email protected]
> https://lists.sourceforge.net/lists/listinfo/astlinux-users
>
> Donations to support AstLinux are graciously accepted via PayPal to
> [email protected].
>
>
------------------------------------------------------------------------------
_______________________________________________
Astlinux-users mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/astlinux-users

Donations to support AstLinux are graciously accepted via PayPal to 
[email protected].

Reply via email to