Asterisk cmd Pickup

Pickup

Asterisk now comes with its own directed Pickup application, see bug 4865. This will conflict with the bristuff app_pickup. Therefore the current version of bristuff (0.3) changed the name of this application to DPickup.

Synopsis

Pickup(extension[@context])

Be careful! For bristuff 1.4.21.2 DPickup() will pick up the extension, whereas Pickup() will try to pick up a group.

Description

This dialplan command allows you to pick up calls that are ringing a specific extension. The device which is ringing need not have callgroup or pickupgroup set, you just need to know the extension.
This application also allows you to specify partial extensions. For example, you have block 200 to 209 and you want to pick up any calls that my be ringing on those 10 phones, you just pickup 20 and it'll pick up the most recent ringing one. Another side effect is that you can pickup a call that a person might be making for an outbound call... rather cool :-)
An example for the dialplan is below, and installation can be accomplished by using astxs or manually modifying the Makefile.

New in Asterisk 1.6.x

Now also availble: PickupChan()

New in Asterisk 1.6.2: chan_sip is now using the PickUp app to try and pickup the extension. If you put the hint in the same context as the extension this will just work, but if you have them both in separate contexts you have to do some additional stuff. This is described in sip.conf.sample by the notifycid option: This feature adds a call-id value into the XML of a SIP_NOTIFY message sent to alert a subscriber that a device is ringing. This option is only enabled when the new 'notifycid' option is set

To get things to work with the hint in a different context from the extension, you will have to set notifycid=ignore-context in sip.conf. Then you must use the PICKUPMARK channel variable as described in the PickUp app documentation to match the extension correctly.

New in Asterisk v1.4

If you use the special string "PICKUPMARK" for the context parameter, for example 10@PICKUPMARK, this application tries to find a channel which has defined a channel variable name PICKUPMARK with the same content as "extension".


Warning: Do not use a global variable for PICKUPMARK - this should be a normal channel variable instead. Otherwise every call made to extension 1234, 1235, etc would overwrite the global variable and so only the last call made to an extension can be picked up. As for channel variables: pay attention to variable inheritance. So, in the dialplan you must implement pickup logic like:

exten => _*8.,1,Pickup(${EXTEN:2}@PICKUPMARK)
exten => _*8.,n,Hangup()

Don't set PICKUPMARK in the "extension" _*8. like in the example given below, that's nonsense. You should set the channel variable when making a call to the extension, something like:

exten => 1234,1,Set(__PICKUPMARK=1234)
exten => 1234,n,Dial(...)

Please take note of the two underscores before the variable name. That means "inherit unlimited depth". You should be using macros to define extensions, so better add that line to the macro. If you do so, your pickup logic will work seamlessly.
Correction: It is sufficient to use a single underscore for "inherit once" instead of two undescores!


xubec: Warning Using asterisk 1.4.21 and Grandstream GXP2000 fails to pickup any extensions. Sample error trying to pick up extension 100:
WARNING[2566]: channel.c:4399 ast_get_group: Ignoring invalid group 100 (maximum group is 63)

To avoid this problem use DPickup command instead. Like this:
exten => _**.,1,SET(GLOBAL(PICKUPMARK)=${EXTEN:2}) ; Note: Better NOT use a GLOBAL variable here!
exten => _**.,n,DPickup(${EXTEN:2}) ; Note: DPickup() is not part of a standard Asterisk, but provided by a patch/fork.

Then it worked for me.


See bug/patch 5694:
Modified the Pickup application to accept multiple extensions pickup syntax,like

Pickup(extension1&extension2&...)

For example,

Pickup(601&602&603)

will try to pickup extension 601, 602, 603 sequentially, if one of them is in ringing state.

Example

exten => _7.,1,Pickup(${EXTEN:1}@default)

If phone with number 42 rings you can catch the call by dialing 742. You don't need to use the context,
exten => _7.,1,Pickup(${EXTEN:1}) works for all contexts.

Example using PICKUPMARK for Asterisk 1.4


[macro-inbound]
exten => s,1,Set(_PICKUPMARK=${MACRO_EXTEN})
exten => s,n,Dial(SIP/SomeSipPhone,20,rwt)

[inbound]
exten => 123,1,Macro(inbound)
exten => _12[2-6],1,Macro(inbound)

[internal]
exten => *8121,1,Pickup(121@PICKUPMARK)
exten => *8122,1,Pickup(122@inbound)
exten => _*812[34],1,Pickup(123@PICKUPMARK&124@PICKUPMARK)
exten => _*812[5-6],1,Pickup(125@inbound&126@PICKUPMARK)

Bristuff

Bristuff introduced its own Pickup application before Asterisk had its own (see Asterisk cmd BristuffPickup ). The Asterisk Pickup version is therefore renamed to DPickup in Bristuff >= 0.3.

Remark:

This command pickups up the dialed EXTENSION, not the ringing channel/device.
So when the dialplan says;

200,1,Dial(SIP/100&SIP/101)

And someone calls extension 200
The call cannot be picked up by using Pickup(100@default) or Pickup(101@default)
But needs to be picked up using Pickup(200@default)

The context however is NOT mandatory

Multiple context pickup


If you have multiple contextes where calls are incomming,
for example external (for calls from outside) and internal (for internal calls),
you can use following pickup setup to get the pickup working:

exten => _71XXX,1,Pickup(${EXTEN:2}@external)
exten => _71XXX,2,Pickup(${EXTEN:2}@internal)

In the example above, you can pickup a caller from outside,
who is calling an extension (and going into the context external),
and also you can pickup a caller from internal call.

Another multiple context pickup


When channel ringing, run: core show channels.

Calling internal link 24 output may be:
  • for internet sip link: SIP/192.168.0.10-084 24@internet:2 Ring Dial(SIP/24|30)
  • for isdn link: Zap/1-1 466510710@isdn:3 Ringing Dial(SIP/24|30)

extensions.conf:
[isdn] ;input context from isdn
exten => 466510710,n,Set(PICKUP_24,${EXTEN})
exten => 466510710,n,Dial(SIP/24)

[internet] ;input context from internet sip
exten => 24,n,Dial(SIP/${EXTEN})

[local] ;input context from local sip
...
;Grandstream BLF pickup link 24 dialls **24
exten => _**2X,1,ImportVar(ISDN_PICKUP=isdn|PICKUP_${EXTEN:2})
exten => _**2X,n,DPickup(${EXTEN:2}@internet) ;24@internet
exten => _**2X,n,DPickup(${ISDN_PICKUP}@isdn) ;466510710@isdn
exten => _**2X,n,Hangup()

Troubleshooting


See also



Go back to Asterisk - documentation of application commands

Pickup

Asterisk now comes with its own directed Pickup application, see bug 4865. This will conflict with the bristuff app_pickup. Therefore the current version of bristuff (0.3) changed the name of this application to DPickup.

Synopsis

Pickup(extension[@context])

Be careful! For bristuff 1.4.21.2 DPickup() will pick up the extension, whereas Pickup() will try to pick up a group.

Description

This dialplan command allows you to pick up calls that are ringing a specific extension. The device which is ringing need not have callgroup or pickupgroup set, you just need to know the extension.
This application also allows you to specify partial extensions. For example, you have block 200 to 209 and you want to pick up any calls that my be ringing on those 10 phones, you just pickup 20 and it'll pick up the most recent ringing one. Another side effect is that you can pickup a call that a person might be making for an outbound call... rather cool :-)
An example for the dialplan is below, and installation can be accomplished by using astxs or manually modifying the Makefile.

New in Asterisk 1.6.x

Now also availble: PickupChan()

New in Asterisk 1.6.2: chan_sip is now using the PickUp app to try and pickup the extension. If you put the hint in the same context as the extension this will just work, but if you have them both in separate contexts you have to do some additional stuff. This is described in sip.conf.sample by the notifycid option: This feature adds a call-id value into the XML of a SIP_NOTIFY message sent to alert a subscriber that a device is ringing. This option is only enabled when the new 'notifycid' option is set

To get things to work with the hint in a different context from the extension, you will have to set notifycid=ignore-context in sip.conf. Then you must use the PICKUPMARK channel variable as described in the PickUp app documentation to match the extension correctly.

New in Asterisk v1.4

If you use the special string "PICKUPMARK" for the context parameter, for example 10@PICKUPMARK, this application tries to find a channel which has defined a channel variable name PICKUPMARK with the same content as "extension".


Warning: Do not use a global variable for PICKUPMARK - this should be a normal channel variable instead. Otherwise every call made to extension 1234, 1235, etc would overwrite the global variable and so only the last call made to an extension can be picked up. As for channel variables: pay attention to variable inheritance. So, in the dialplan you must implement pickup logic like:

exten => _*8.,1,Pickup(${EXTEN:2}@PICKUPMARK)
exten => _*8.,n,Hangup()

Don't set PICKUPMARK in the "extension" _*8. like in the example given below, that's nonsense. You should set the channel variable when making a call to the extension, something like:

exten => 1234,1,Set(__PICKUPMARK=1234)
exten => 1234,n,Dial(...)

Please take note of the two underscores before the variable name. That means "inherit unlimited depth". You should be using macros to define extensions, so better add that line to the macro. If you do so, your pickup logic will work seamlessly.
Correction: It is sufficient to use a single underscore for "inherit once" instead of two undescores!


xubec: Warning Using asterisk 1.4.21 and Grandstream GXP2000 fails to pickup any extensions. Sample error trying to pick up extension 100:
WARNING[2566]: channel.c:4399 ast_get_group: Ignoring invalid group 100 (maximum group is 63)

To avoid this problem use DPickup command instead. Like this:
exten => _**.,1,SET(GLOBAL(PICKUPMARK)=${EXTEN:2}) ; Note: Better NOT use a GLOBAL variable here!
exten => _**.,n,DPickup(${EXTEN:2}) ; Note: DPickup() is not part of a standard Asterisk, but provided by a patch/fork.

Then it worked for me.


See bug/patch 5694:
Modified the Pickup application to accept multiple extensions pickup syntax,like

Pickup(extension1&extension2&...)

For example,

Pickup(601&602&603)

will try to pickup extension 601, 602, 603 sequentially, if one of them is in ringing state.

Example

exten => _7.,1,Pickup(${EXTEN:1}@default)

If phone with number 42 rings you can catch the call by dialing 742. You don't need to use the context,
exten => _7.,1,Pickup(${EXTEN:1}) works for all contexts.

Example using PICKUPMARK for Asterisk 1.4


[macro-inbound]
exten => s,1,Set(_PICKUPMARK=${MACRO_EXTEN})
exten => s,n,Dial(SIP/SomeSipPhone,20,rwt)

[inbound]
exten => 123,1,Macro(inbound)
exten => _12[2-6],1,Macro(inbound)

[internal]
exten => *8121,1,Pickup(121@PICKUPMARK)
exten => *8122,1,Pickup(122@inbound)
exten => _*812[34],1,Pickup(123@PICKUPMARK&124@PICKUPMARK)
exten => _*812[5-6],1,Pickup(125@inbound&126@PICKUPMARK)

Bristuff

Bristuff introduced its own Pickup application before Asterisk had its own (see Asterisk cmd BristuffPickup ). The Asterisk Pickup version is therefore renamed to DPickup in Bristuff >= 0.3.

Remark:

This command pickups up the dialed EXTENSION, not the ringing channel/device.
So when the dialplan says;

200,1,Dial(SIP/100&SIP/101)

And someone calls extension 200
The call cannot be picked up by using Pickup(100@default) or Pickup(101@default)
But needs to be picked up using Pickup(200@default)

The context however is NOT mandatory

Multiple context pickup


If you have multiple contextes where calls are incomming,
for example external (for calls from outside) and internal (for internal calls),
you can use following pickup setup to get the pickup working:

exten => _71XXX,1,Pickup(${EXTEN:2}@external)
exten => _71XXX,2,Pickup(${EXTEN:2}@internal)

In the example above, you can pickup a caller from outside,
who is calling an extension (and going into the context external),
and also you can pickup a caller from internal call.

Another multiple context pickup


When channel ringing, run: core show channels.

Calling internal link 24 output may be:
  • for internet sip link: SIP/192.168.0.10-084 24@internet:2 Ring Dial(SIP/24|30)
  • for isdn link: Zap/1-1 466510710@isdn:3 Ringing Dial(SIP/24|30)

extensions.conf:
[isdn] ;input context from isdn
exten => 466510710,n,Set(PICKUP_24,${EXTEN})
exten => 466510710,n,Dial(SIP/24)

[internet] ;input context from internet sip
exten => 24,n,Dial(SIP/${EXTEN})

[local] ;input context from local sip
...
;Grandstream BLF pickup link 24 dialls **24
exten => _**2X,1,ImportVar(ISDN_PICKUP=isdn|PICKUP_${EXTEN:2})
exten => _**2X,n,DPickup(${EXTEN:2}@internet) ;24@internet
exten => _**2X,n,DPickup(${ISDN_PICKUP}@isdn) ;466510710@isdn
exten => _**2X,n,Hangup()

Troubleshooting


See also



Go back to Asterisk - documentation of application commands

Created by: JustRumours, Last modification: Fri 04 of May, 2012 (18:46 UTC) by admin
Please update this page with new information, just login and click on the "Edit" or "Discussion" tab. Get a free login here: Register Thanks! - Find us on Google+