Re: [asterisk-users] Rejecting transfers to in-use parking spaces

2012-02-24 Thread Phil Frost
On Feb 23, 2012, at 18:44 , Bryant Zimmerman wrote:
 
 I was working on this today. I have it figured out but I don't have simple 
 dialplan code I can share as we are doing a lot of external db and script 
 calls to make ours work with our realtime stuff. We also are using the 
 Dynamic Parking stuff as well I pulled that out to simplify things. [dialplan 
 example follows]

Thanks, that was very helpful. I tweaked a bit, and ended up with this working 
code:

exten = _70[123],1,NoOp(Dynamic Parking Pickup from ${BLINDTRANSFER})
; if this was a blind transfer, attempt to park the call. Otherwise, unpark
; the call.
same = n,GoToIf($[${LEN(${BLINDTRANSFER})}  0]?attemptpark)
same = n,ParkedCall(${EXTEN})

same = 100(attemptpark),NoOp(Attempt To Park)
same = n,Set(PARKRETURNTO=${CUT(BLINDTRANSFER,-,1)})
same = n,Set(PARKINGEXTEN=${EXTEN})
same = n,Park(,${CONTEXT},${EXTEN},200,s)  ; return priority here must be 
a number, not a label.
same = n,Goto(200)

; send the call back to the sender. Either the park timed out, or the
; parking space was in use, or otherwise failed to park.
same = 200(backtosender),Dial(${PARKRETURNTO},300)

I'm a bit unsure if grabbing the channel name from BLINDTRANFSER, cutting off 
the bit after -, and passing that to Dial() is the Right Thing. It appears to 
work, though I'm quite inexperienced. I guess my concern is that the channel 
names might not necessarily be a dial()able thing. Of course, it would be 
better if I could just reject the transfer, but that doesn't sound like it's 
possible. Anyone have pointers on how to make this more robust? Is there any 
way I can get more information about the channel referenced by BLINDTRANSFER? 
Maybe I'll also dial the front desk after dialing PARKRETURNTO, just in case.

On the phone side, I configured three BLFs for 701-703. This does require that 
to park a caller, the receptionist hits transfer, then the BLF. However, this 
is more explicit, and avoids a weird case where someone else parks a call just 
before the receptionist hits the park button, so she ends up putting the caller 
on hold and unparking someone else, rather than parking the caller as she 
intended. I think I'll teach users to not depend so heavily on park, and they 
will adapt.

--
_
-- Bandwidth and Colocation Provided by http://www.api-digital.com --
New to Asterisk? Join us for a live introductory webinar every Thurs:
   http://www.asterisk.org/hello

asterisk-users mailing list
To UNSUBSCRIBE or update options visit:
   http://lists.digium.com/mailman/listinfo/asterisk-users


[asterisk-users] Rejecting transfers to in-use parking spaces

2012-02-23 Thread Phil Frost
I'm trying to emulate the functionality of our existing phone system, which is 
somewhat different than what Asterisk provides with a trivial parking 
configuration. I'd like each user to have three park buttons, park 1, park 2, 
park 3. The snom 870s I'm using have a Park+Orbit button, which best I can 
determine, is a shortcut to transfer someone to an extension. So, I defined 
some extensions:

exten = _*70[123],1,NoOp(parking in ${EXTEN:1})
same = n,Set(PARKINGEXTEN=${EXTEN:1})
same = 
n,GotoIf(${DEVICE_STATE(park:${PARKINGEXTEN}@parkedcalls)}=INUSE?busy)
same = n,Park()
same = n(busy),Busy()

As you can see, I'm calling Busy() if someone is already parked in the space, 
but this doesn't do what I'd like. What I'm hoping to accomplish is have 
Asterisk respond to the Sip REFER to *701 with a 404 or similar response; if 
Asterisk can do this, then the Snom will say transfer failed!. As it is, the 
transfer is successful, and the caller hears a busy tone. Is there an 
application that has the effect of Pretend this extension doesn't exist, or 
can I somehow get the caller back to the person that tried to park them in this 
space that's in use?




Also, if anyone has specific experience with the Snoms, I'd like to improve 
this further. The Park+Orbit buttons seem to transfer the caller to an 
extension, and I can use a BLF button to monitor the spaces and unpark calls. 
It would be better if I could do this with just one button which parks the 
caller if currently on a call, or which unparks a call if I'm not on a call. 
Anyone have some idea how to accomplish this with the Snom 870?

--
_
-- Bandwidth and Colocation Provided by http://www.api-digital.com --
New to Asterisk? Join us for a live introductory webinar every Thurs:
   http://www.asterisk.org/hello

asterisk-users mailing list
To UNSUBSCRIBE or update options visit:
   http://lists.digium.com/mailman/listinfo/asterisk-users


Re: [asterisk-users] Rejecting transfers to in-use parking spaces

2012-02-23 Thread Richard Mudgett
 I'm trying to emulate the functionality of our existing phone system,
 which is somewhat different than what Asterisk provides with a
 trivial parking configuration. I'd like each user to have three park
 buttons, park 1, park 2, park 3. The snom 870s I'm using have a
 Park+Orbit button, which best I can determine, is a shortcut to
 transfer someone to an extension. So, I defined some extensions:
 
 exten = _*70[123],1,NoOp(parking in ${EXTEN:1})
 same = n,Set(PARKINGEXTEN=${EXTEN:1})
 same =
 n,GotoIf(${DEVICE_STATE(park:${PARKINGEXTEN}@parkedcalls)}=INUSE?busy)
 same = n,Park()
 same = n(busy),Busy()
 
 As you can see, I'm calling Busy() if someone is already parked in
 the space, but this doesn't do what I'd like. What I'm hoping to
 accomplish is have Asterisk respond to the Sip REFER to *701 with a
 404 or similar response; if Asterisk can do this, then the Snom will
 say transfer failed!. As it is, the transfer is successful, and
 the caller hears a busy tone. Is there an application that has the
 effect of Pretend this extension doesn't exist, or can I somehow
 get the caller back to the person that tried to park them in this
 space that's in use?

The dialplan device state check above is not always going to work
because another call could park in that space between the check
and the actual park.  The device state check in this case is
also unnecessary because Park will continue executing dialplan if
the park fails.

You could try three parkinglots with one parking space each.  Each
phone park button would transfer the call to a different parkinglot.
Then all you need to do is include the parkinglot context(s) into your
dialplan context to have access to the generated parking extensions.

Please note that for Asterisk to detect an extension as a parking
extension, the first priority of the extension must be the park
application.  If the park application is not the first priority of
the extension, then the transfer is treated as a normal transfer.

Richard

--
_
-- Bandwidth and Colocation Provided by http://www.api-digital.com --
New to Asterisk? Join us for a live introductory webinar every Thurs:
   http://www.asterisk.org/hello

asterisk-users mailing list
To UNSUBSCRIBE or update options visit:
   http://lists.digium.com/mailman/listinfo/asterisk-users


Re: [asterisk-users] Rejecting transfers to in-use parking spaces

2012-02-23 Thread Phil Frost
On Feb 23, 2012, at 16:32 , Richard Mudgett wrote:
 exten = _*70[123],1,NoOp(parking in ${EXTEN:1})
same = n,Set(PARKINGEXTEN=${EXTEN:1})
same =
n,GotoIf(${DEVICE_STATE(park:${PARKINGEXTEN}@parkedcalls)}=INUSE?busy)
same = n,Park()
same = n(busy),Busy()
 
 What I'm hoping to
 accomplish is have Asterisk respond to the Sip REFER to *701 with a
 404 or similar response; if Asterisk can do this, then the Snom will
 say transfer failed!.

 The dialplan device state check above is not always going to work
 because another call could park in that space between the check
 and the actual park. [...]
 
 Please note that for Asterisk to detect an extension as a parking
 extension, the first priority of the extension must be the park
 application.  If the park application is not the first priority of
 the extension, then the transfer is treated as a normal transfer.


Hmm. Well, I could live with that race condition. Our call volume is low enough 
that the odds of hitting it acceptably low.

I'm not entirely sure what it means for Asterisk to detect an extension as a 
parking extension. Can you please explain how a parking transfer is different 
than a normal transfer?

--
_
-- Bandwidth and Colocation Provided by http://www.api-digital.com --
New to Asterisk? Join us for a live introductory webinar every Thurs:
   http://www.asterisk.org/hello

asterisk-users mailing list
To UNSUBSCRIBE or update options visit:
   http://lists.digium.com/mailman/listinfo/asterisk-users


Re: [asterisk-users] Rejecting transfers to in-use parking spaces

2012-02-23 Thread Richard Mudgett
  exten = _*70[123],1,NoOp(parking in ${EXTEN:1})
 same = n,Set(PARKINGEXTEN=${EXTEN:1})
 same =
 n,GotoIf(${DEVICE_STATE(park:${PARKINGEXTEN}@parkedcalls)}=INUSE?busy)
 same = n,Park()
 same = n(busy),Busy()
  
  What I'm hoping to
  accomplish is have Asterisk respond to the Sip REFER to *701 with
  a
  404 or similar response; if Asterisk can do this, then the Snom
  will
  say transfer failed!.
 
  The dialplan device state check above is not always going to work
  because another call could park in that space between the check
  and the actual park. [...]
  
  Please note that for Asterisk to detect an extension as a parking
  extension, the first priority of the extension must be the park
  application.  If the park application is not the first priority of
  the extension, then the transfer is treated as a normal transfer.
 
 
 Hmm. Well, I could live with that race condition. Our call volume is
 low enough that the odds of hitting it acceptably low.

The next sentence also tried to point out that the check is not even
needed because if Park fails for whatever reason, it continues executing
dialplan.  With that dialplan, it is mainly going to fail if the parking
space is already in use.

 I'm not entirely sure what it means for Asterisk to detect an
 extension as a parking extension. Can you please explain how a
 parking transfer is different than a normal transfer?

If Asterisk detects the extension as a parking extension:
exten = 700,1,Park()
Asterisk can perform special processing dealing with parking the
call that may be needed for the channel driver.  Also note that the
dialplan extension is *not* actually executed in this case.

For SIP, blind transferring to parking, the parking is done as part
of the transfer.  If the park attempt fails, the transfer fails.  A
normal blind transfer would complete the transfer and then execute
the dialplan extension on the transferred channel.

For DTMF transfers (features.conf), attended and blind transferring
to parking are identical.  You will always hear the parking space
assigned.  If the park attempt fails, the interrupted bridge will be
resumed.

Richard

--
_
-- Bandwidth and Colocation Provided by http://www.api-digital.com --
New to Asterisk? Join us for a live introductory webinar every Thurs:
   http://www.asterisk.org/hello

asterisk-users mailing list
To UNSUBSCRIBE or update options visit:
   http://lists.digium.com/mailman/listinfo/asterisk-users


Re: [asterisk-users] Rejecting transfers to in-use parking spaces

2012-02-23 Thread Bryant Zimmerman


 From: Phil Frost p...@macprofessionals.com
Sent: Thursday, February 23, 2012 4:39 PM
To: Asterisk Users Mailing List - Non-Commercial Discussion 
asterisk-users@lists.digium.com
Subject: Re: [asterisk-users] Rejecting transfers to in-use parking spaces

On Feb 23, 2012, at 16:32 , Richard Mudgett wrote:
 exten = _*70[123],1,NoOp(parking in ${EXTEN:1})
 same = n,Set(PARKINGEXTEN=${EXTEN:1})
 same =
 n,GotoIf(${DEVICE_STATE(park:${PARKINGEXTEN}@parkedcalls)}=INUSE?busy)
 same = n,Park()
 same = n(busy),Busy()
 
 What I'm hoping to
 accomplish is have Asterisk respond to the Sip REFER to *701 with a
 404 or similar response; if Asterisk can do this, then the Snom will
 say transfer failed!.

 The dialplan device state check above is not always going to work
 because another call could park in that space between the check
 and the actual park. [...]
 
 Please note that for Asterisk to detect an extension as a parking
 extension, the first priority of the extension must be the park
 application. If the park application is not the first priority of
 the extension, then the transfer is treated as a normal transfer.

Hmm. Well, I could live with that race condition. Our call volume is low 
enough that the odds of hitting it acceptably low.

I'm not entirely sure what it means for Asterisk to detect an extension as 
a parking extension. Can you please explain how a parking transfer is 
different than a normal transfer?

--
_

I was working on this today. I have it figured out but I don't have simple 
dialplan code I can share as we are doing a lot of external db and script 
calls to make ours work with our realtime stuff. We also are using the 
Dynamic Parking stuff as well I pulled that out to simplify things. 

[DoPark-Pickup-BlindPark] 

exten = s,1,NoOp(Dynamic Parking Pickup)
exten = s,n,NoOp(Return Parked Call)
exten = s,n,GoToIf($[${LEN(${BLINDTRANSFER})}  0]?doParkAttempt,1) 

exten = s,n,ParkedCall( PLACE DIALED EXTENSION VARIABLE HERE) 

exten = doParkAttempt,1,NoOp(Attempt To Park)
Place logic to parse the ${BLINDTRANSFER}  to get the return to extension  


exten = doParkAttempt,n,Set(PARKINGLOT=Your Lot or var to handle the 
lot)
exten = doParkAttempt,n,Set(PARKINGEXTEN=( PLACE DIALED EXTENSION VARIABLE 
HERE)) 
exten = doParkAttempt,n,Park(time out, return_context, return_ext, return 
priority, s)

If park fails return the call back to your return context, exten, priotiry

exten = doParkAttempt,n,Goto(return_context,return,ext, return priority) 

Good luck
Bryant exten = doParkAttempt,n,Goto(return_context,return,ext, return 
priority) Good luckBryant
--
_
-- Bandwidth and Colocation Provided by http://www.api-digital.com --
New to Asterisk? Join us for a live introductory webinar every Thurs:
   http://www.asterisk.org/hello

asterisk-users mailing list
To UNSUBSCRIBE or update options visit:
   http://lists.digium.com/mailman/listinfo/asterisk-users