My company for various reasons has asked that I come up with a way to have previously parked calls be re-parked in the same parking slot. I have looked at setting up asterisk so that the receptionist chooses which slot to place a call, but I think there is an easier way. That is when I came up with the idea of "Sticky Park". Here is how it would work. A call would come in and the receptionist will park the call as she normally does. Asterisk will the pick the first open parking slot, let's say 702 because there is already a call on 701. Lets say that the call parked on 701 is picked up, freeing 701. So, 701 is free and 702 has our call parked on it. Now the call on 702 rings back to the receptionist because it has timed out. She asks the person if they would like to continue hold and will again park the call as she normally does. Asterisk will then re-park the call back onto 702 because that is where it came from. The normal behavior of Asterisk would of been to park it on 701 because it is the first free parking slot. That is why I call it "Sticky Park". So what happens if between the time she picks up the call and re-parks it someone else parks a call on 702? Then I think Asterisk should then pick the first available parking slot and that call becomes stuck to that parking slot if additional re-parks are necessary. Here is my dialplan on how I thought I could accomplish this with dial-plan magic. Here is the relevant features.conf entries. [general] parkext => 799 ;We need to use our own 700 extension so lets get this out of the way. parkpos => 702-706 comebacktoorigin = no ;This causes calls that have timed out to come to the parkedcallstimeout context at s,1. Ok now onto my Dial Plan. [from_internal] include => parkedcalls ; Gotta have this or things don't work. ;I do an attended transfer to 700. exten => 700,1,Answer() ;Just so I can see if anything has been set exten => 700,n,NoOp(I want to be parked on: ${PARKINGEXTEN}) ;Also so I can see what the state of that parking slot is. exten => 700,n,NoOp(Device State is: ${DEVICE_STATE(park:${PARKINGEXTEN}@parkedcalls)}) ;Check to see if PARKINGEXTEN is set. If not then this must be a new call being park, let's let asterisk find a spot for it. exten => 700,n,GotoIf($[${LEN(${PARKINGEXTEN})}=0]?parkcall) ;Ok Looks like this call has been parked before. Let's see if we can repark it in the same spot again. If it not INUSE then let's park the call. exten => 700,n,GotoIf($[${DEVICE_STATE(park:${PARKINGEXTEN}@parkedcalls)}=INUSE]?:parkcall) ;Previous slot is not occupied lets clear the PARKINGEXTEN variable so that when we park the call Asterisk will find the first available slot. exten => 700,n,Set(PARKINGEXTEN=) ;Lets park the call. exten => 700,n(parkcall),Park() exten => 700,n,Hangup() [parkedcallstimeout] exten => _SIP011XX,1,Answer() exten => _SIP011XX,n,NoOp(Call Parked on: ${PARKINGSLOT}) exten => _SIP011XX,n,NoOp(This is who parked us: ${EXTEN}) exten => _SIP011XX,n,Set(PARKINGEXTEN=${PARKINGSLOT}) ;This sets the PARKINGEXTEN to the parking slot we were parked in. exten => _SIP011XX,n,Dial(SIP/${EXTEN:4:4},${RINGTIMER},${INTERNAL_DIAL_OPTIONS}) ;This send the call back to the person who parked it. There are a couple of global variables I use here. Nothing unusual here. So what is the problem? Well the problem is that the PARKINGEXTEN variable gets reset after the dial command in parkedcallstimeout. That makes it so I cannot find out where that call was originally parked If I can find out how to get that little bit of information when the call is re-parked then I think this will work. If anyone has any suggestions on how to accomplish this I would be grateful. Thanks, Mat Murdock -- This message has been scanned for viruses and dangerous content by MailScanner, and is believed to be clean.
You could put something into the Asterisk Database with DBput/DBget. I don't have an example off hand, but create a "stickypark" family and store which channels go back into which parking slot. Or something to that effect, and it would exist until you remove it from the database. -Jonathan On Thu, Aug 27, 2009 at 10:52 AM, Mat Murdock<mmurdock at kimballequipment.com> wrote:> My company for various reasons has asked that I come up with a way to > have previously parked calls be re-parked in the same parking slot. ?I > have looked at setting up asterisk so that the receptionist chooses > which slot to place a call, but I think there is an easier way. ?That is > when I came up with the idea of "Sticky Park". ?Here is how it would > work. ?A call would come in and the receptionist will park the call as > she normally does. ?Asterisk will the pick the first open parking slot, > let's say 702 because there is already a call on 701. ?Lets say that the > call parked on 701 is picked up, freeing 701. ?So, 701 is free and 702 > has our call parked on it. ?Now the call on 702 rings back to the > receptionist because it has timed out. ?She asks the person if they > would like to continue hold and will again park the call as she normally > does. ?Asterisk will then re-park the call back onto 702 because that is > where it came from. ?The normal behavior of Asterisk would of been to > park it on 701 because it is the first free parking slot. ?That is why I > call it "Sticky Park". ? So what happens if between the time she picks > up the call and re-parks it someone else parks a call on 702? ?Then I > think Asterisk should then pick the first available parking slot and > that call becomes stuck to that parking slot if additional re-parks are > necessary. > > Here is my dialplan on how I thought I could accomplish this with > dial-plan magic. > > Here is the relevant features.conf entries. > > [general] > parkext => 799 ? ;We need to use our own 700 extension so lets get this > out of the way. > parkpos => 702-706 > > comebacktoorigin = no ? ? ?;This causes calls that have timed out to > come to the parkedcallstimeout context at s,1. > > > Ok now onto my Dial Plan. > > [from_internal] > include => parkedcalls ? ; Gotta have this or things don't work. > > ;I do an attended transfer to 700. > exten => 700,1,Answer() > ;Just so I can see if anything has been set > exten => 700,n,NoOp(I want to be parked on: ${PARKINGEXTEN}) > ;Also so I can see what the state of that parking slot is. > exten => 700,n,NoOp(Device State is: > ${DEVICE_STATE(park:${PARKINGEXTEN}@parkedcalls)}) > ;Check to see if PARKINGEXTEN is set. ?If not then this must be a new > call being park, let's let asterisk find a spot for it. > exten => 700,n,GotoIf($[${LEN(${PARKINGEXTEN})}=0]?parkcall) > ;Ok Looks like this call has been parked before. ?Let's see if we can > repark it in the same spot again. ?If it not INUSE then let's park the call. > exten => > 700,n,GotoIf($[${DEVICE_STATE(park:${PARKINGEXTEN}@parkedcalls)}=INUSE]?:parkcall) > ;Previous slot is not occupied lets clear the PARKINGEXTEN variable so > that when we park the call Asterisk will find the first available slot. > exten => 700,n,Set(PARKINGEXTEN=) > ;Lets park the call. > exten => 700,n(parkcall),Park() > exten => 700,n,Hangup() > > > > [parkedcallstimeout] > > exten => _SIP011XX,1,Answer() > exten => _SIP011XX,n,NoOp(Call Parked on: ${PARKINGSLOT}) > exten => _SIP011XX,n,NoOp(This is who parked us: ${EXTEN}) > exten => _SIP011XX,n,Set(PARKINGEXTEN=${PARKINGSLOT}) > ;This sets the PARKINGEXTEN to the parking slot we were parked in. > exten => > _SIP011XX,n,Dial(SIP/${EXTEN:4:4},${RINGTIMER},${INTERNAL_DIAL_OPTIONS}) > ;This send the call back to the person who parked it. ?There are a > couple of global variables I use here. ?Nothing unusual here. > > > So what is the problem? ?Well the problem is that the PARKINGEXTEN > variable gets reset after the dial command in parkedcallstimeout. ?That > makes it so I cannot find out where that call was originally parked ?If > I can find out how to get that little bit of information when the call > is re-parked then I think this will work. ?If anyone has any suggestions > on how to accomplish this I would be grateful. > > Thanks, > > Mat Murdock > > > > > -- > This message has been scanned for viruses and > dangerous content by MailScanner, and is > believed to be clean. > > > _______________________________________________ > -- Bandwidth and Colocation Provided by http://www.api-digital.com -- > > AstriCon 2009 - October 13 - 15 Phoenix, Arizona > Register Now: http://www.astricon.net > > asterisk-users mailing list > To UNSUBSCRIBE or update options visit: > ? http://lists.digium.com/mailman/listinfo/asterisk-users >
At 11:52 AM on 27 Aug 2009, Mat Murdock wrote:> [parkedcallstimeout] > > exten => _SIP011XX,1,Answer() > exten => _SIP011XX,n,NoOp(Call Parked on: ${PARKINGSLOT}) > exten => _SIP011XX,n,NoOp(This is who parked us: ${EXTEN}) > exten => _SIP011XX,n,Set(PARKINGEXTEN=${PARKINGSLOT}) > ;This sets the PARKINGEXTEN to the parking slot we were parked in. > exten => > _SIP011XX,n,Dial(SIP/${EXTEN:4:4},${RINGTIMER},${INTERNAL_DIAL_OPTIONS}) > ;This send the call back to the person who parked it. There are a > couple of global variables I use here. Nothing unusual here. > > > So what is the problem? Well the problem is that the PARKINGEXTEN > variable gets reset after the dial command in parkedcallstimeout. > That makes it so I cannot find out where that call was originally > parked If I can find out how to get that little bit of information > when the call is re-parked then I think this will work. If anyone > has any suggestions on how to accomplish this I would be grateful.Have you tried prefixing PARKINGEXTEN with '__' (two underscores) on the Set call in parkedcallstimeout? That makes it a persistent variable, which will be inherited by sub-channels, like after a Dial. exten => _SIP011XX,n,Set(__PARKINGEXTEN=${PARKINGSLOT}) You might only need one underscore. For more info, see 'core show application set'. -- C. Chad Wallace, B.Sc. The Lodging Company http://www.skihills.com/ OpenPGP Public Key ID: 0x262208A0 -------------- next part -------------- A non-text attachment was scrubbed... Name: signature.asc Type: application/pgp-signature Size: 197 bytes Desc: not available Url : http://lists.digium.com/pipermail/asterisk-users/attachments/20090827/1b884d9c/attachment.pgp
Sticky Park sounds like somewhere you go late at night wearing a plastic raincoat. PaulH Mat Murdock wrote:> My company for various reasons has asked that I come up with a way to > have previously parked calls be re-parked in the same parking slot. I > have looked at setting up asterisk so that the receptionist chooses > which slot to place a call, but I think there is an easier way. That is > when I came up with the idea of "Sticky Park". Here is how it would > work. A call would come in and the receptionist will park the call as > she normally does. Asterisk will the pick the first open parking slot, > let's say 702 because there is already a call on 701. Lets say that the > call parked on 701 is picked up, freeing 701. So, 701 is free and 702 > has our call parked on it. Now the call on 702 rings back to the > receptionist because it has timed out. She asks the person if they > would like to continue hold and will again park the call as she normally > does. Asterisk will then re-park the call back onto 702 because that is > where it came from. The normal behavior of Asterisk would of been to > park it on 701 because it is the first free parking slot. That is why I > call it "Sticky Park". So what happens if between the time she picks > up the call and re-parks it someone else parks a call on 702? Then I > think Asterisk should then pick the first available parking slot and > that call becomes stuck to that parking slot if additional re-parks are > necessary. > > Here is my dialplan on how I thought I could accomplish this with > dial-plan magic. > > Here is the relevant features.conf entries. > > [general] > parkext => 799 ;We need to use our own 700 extension so lets get this > out of the way. > parkpos => 702-706 > > comebacktoorigin = no ;This causes calls that have timed out to > come to the parkedcallstimeout context at s,1. > > > Ok now onto my Dial Plan. > > [from_internal] > include => parkedcalls ; Gotta have this or things don't work. > > ;I do an attended transfer to 700. > exten => 700,1,Answer() > ;Just so I can see if anything has been set > exten => 700,n,NoOp(I want to be parked on: ${PARKINGEXTEN}) > ;Also so I can see what the state of that parking slot is. > exten => 700,n,NoOp(Device State is: > ${DEVICE_STATE(park:${PARKINGEXTEN}@parkedcalls)}) > ;Check to see if PARKINGEXTEN is set. If not then this must be a new > call being park, let's let asterisk find a spot for it. > exten => 700,n,GotoIf($[${LEN(${PARKINGEXTEN})}=0]?parkcall) > ;Ok Looks like this call has been parked before. Let's see if we can > repark it in the same spot again. If it not INUSE then let's park the call. > exten => > 700,n,GotoIf($[${DEVICE_STATE(park:${PARKINGEXTEN}@parkedcalls)}=INUSE]?:parkcall) > ;Previous slot is not occupied lets clear the PARKINGEXTEN variable so > that when we park the call Asterisk will find the first available slot. > exten => 700,n,Set(PARKINGEXTEN=) > ;Lets park the call. > exten => 700,n(parkcall),Park() > exten => 700,n,Hangup() > > > > [parkedcallstimeout] > > exten => _SIP011XX,1,Answer() > exten => _SIP011XX,n,NoOp(Call Parked on: ${PARKINGSLOT}) > exten => _SIP011XX,n,NoOp(This is who parked us: ${EXTEN}) > exten => _SIP011XX,n,Set(PARKINGEXTEN=${PARKINGSLOT}) > ;This sets the PARKINGEXTEN to the parking slot we were parked in. > exten => > _SIP011XX,n,Dial(SIP/${EXTEN:4:4},${RINGTIMER},${INTERNAL_DIAL_OPTIONS}) > ;This send the call back to the person who parked it. There are a > couple of global variables I use here. Nothing unusual here. > > > So what is the problem? Well the problem is that the PARKINGEXTEN > variable gets reset after the dial command in parkedcallstimeout. That > makes it so I cannot find out where that call was originally parked If > I can find out how to get that little bit of information when the call > is re-parked then I think this will work. If anyone has any suggestions > on how to accomplish this I would be grateful. > > Thanks, > > Mat Murdock > > > > >