[Home]

Summary:ASTERISK-16356: [patch] (Regression) Pickup from Grandstream BLF button ignores the context specified in Pickup command
Reporter:uros gaber (urosh)Labels:
Date Opened:2010-07-13 05:22:26Date Closed:2010-08-13 13:58:59
Priority:MinorRegression?No
Status:Closed/CompleteComponents:Channels/chan_sip/General
Versions:Frequency of
Occurrence
Related
Issues:
Environment:Attachments:( 0) blf_cid_issue.diff
( 1) chan_sip.txt
( 2) sip_debug
Description:Hi i had problem described in this issue:
https://issues.asterisk.org/view.php?id=17120
asterisk error was:

[Mar 30 09:48:26] NOTICE[30223]: chan_sip.c:19860 handle_request_invite: Trying to pick up 520@blf
[Mar 30 09:48:27] NOTICE[30223]: chan_sip.c:19860 handle_request_invite: Trying to pick up 520@blf
[Mar 30 09:48:27] NOTICE[30223]: app_directed_pickup.c:257 pickup_exec: No target channel found for 520.

I managed to correct it with removing p->callid in line 11302.
I am not a programmer of c++ so I am attaching corrected lines, that worked for me.

Now phone works like in version 1.6.1, where phone on blinking BLF called **EXTEN.

Comments:By: David Vossel (dvossel) 2010-07-30 14:15:03

Are you using the notifycid option?  I believe a combination of the 'notifycid=ignore-context' with the 'PICKUPMARK' dialplan variable will achieve what you are looking for.  This behavior changed between 1.6.2 and 1.6.1.  Take a look this option's documentation in sip.conf.sample.

By: uros gaber (urosh) 2010-07-30 15:56:25

In my sip.conf is notifycid = no.

Should i try with ignore-context? Would phone then call in to the dialplan?

With that change in chan_sip.c I made, works. Phone dials **EXTEN.

By: David Vossel (dvossel) 2010-07-30 16:28:28

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.

To get this to work the way you are trying to do it (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.

Let me know if this helps. This is described in sip.conf.sample by the notifycid option

By: uros gaber (urosh) 2010-07-31 04:28:05

Ok. I will try this next week.

By: Olivier Krief (okrief) 2010-08-02 10:41:12

Using 'notifycid=ignore-context' with 1.6.2.10 solved a similar issue I had with Thomson ST2030S (see issue 17097. as this one is closed, I couldn't add this comment there).

My advice here is to give this sip.conf option a try, though this is not based on personal experience with Grandstream phones.

By: uros gaber (urosh) 2010-08-03 04:31:37

Hi again.

I tested with notifycid=ignore-context, but is not working. I will change chan_sip.c to my patch :)

I attached debug of peer (Granstream gxp2000).
May be code should be corrected, that will check useragent of Grandstream.

By: David Vossel (dvossel) 2010-08-03 16:06:35

You used notifycid=ignore-context, but did you set the PICKUPMARK channel variable?

chan_sip now uses the PickUp dialplan app internally to pickup the extension.  Unless you have the hint in the same context as the extension you are trying to pick up you have to use both the 'notifycid=ignore-context' option in sip.conf and set the 'PICKUPMARK' channel variable on the ringing extension.

PickUp app documentation.
 This application can pickup any ringing channel that is calling the specified
 <extension>. If no <context> is specified, the current context will be used.
 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 ${PICKUPMARK} channel variable with the same value as <extension>
 (in this example, '10'). When no parameter is specified, the application will
 pickup a channel matching the pickup group of the active channel.

By: David Vossel (dvossel) 2010-08-09 11:02:55

urosh, I found a grandstream GXP2020 i could use to test this issue.  I think I have a better understanding of what is going on now.  I should have a patch for this shortly.

By: David Vossel (dvossel) 2010-08-09 11:33:09

urosh, I tested this feature with my GXP2020 and it worked perfectly.  I'm curious if this isn't resolved or introduced by the latest grandstream firmware.  The version I tested with was 1.1.4.14, which is very old. July 2007.  What version are you using?  Does it have the "Asterisk BLF" option?

While setting up the GXP2020 I configured the first multi purpose key to use "Asterisk BLF" and pointed at the extension of the hint (6001).  When I attempted to pickup the extension the GXP2020 sent an invite to extension **6000, which matched my pickup extension, exten => _**6XXX,1,PickUp(${EXTEN:2}@extensions).

By: uros gaber (urosh) 2010-08-09 14:30:36

I will test with PICKUPMARK set and report.This week.

By: uros gaber (urosh) 2010-08-09 14:36:22

I have 1.2.3.5 firmware version. GXP2000 (HW1.1A)

By: Alec Davis (alecdavis) 2010-08-10 22:28:24

dvossel and urosh.
after you get directed pickup working with a grandstream (fw 1.2.3.5) then try to put that picked up call on Hold or Transfer.
ASTERISK-16534 may help.

By: uros gaber (urosh) 2010-08-12 09:03:28

I tried suggested and it still doesn't work. I tested with:
exten => 1111, 1, NoCDR()
exten => 1111, n, Set(__PICKUPMARK=company_internal)
exten => 1111, n, Set(__PICKUPMARK=298@company_internal)
exten => 1111, n, Set(_PICKUPMARK=company_internal)
exten => 1111, n, Set(_PICKUPMARK=298@company_internal)
exten => 1111, n, Set(PICKUPMARK=company_internal)
exten => 1111, n, Set(PICKUPMARK=298@company_internal)
exten => 1111, n, Dial(SIP/298)
and
exten => 1111, 1, NoCDR()
exten => 1111, n, Set(__PICKUPMARK=BLF)
exten => 1111, n, Set(__PICKUPMARK=298@BLF)
exten => 1111, n, Set(_PICKUPMARK=BLF)
exten => 1111, n, Set(_PICKUPMARK=298@BLF)
exten => 1111, n, Set(PICKUPMARK=BLF)
exten => 1111, n, Set(PICKUPMARK=298@BLF)
exten => 1111, n, Dial(SIP/298)
I even add an extension in BLF context:
exten => _**XXX, 1, NoOp(testing)

Problem is that asterisk doesn't go into the dialplan. Our dialplan for pickup:

;#########################################################
;########## PICKUP ##########
exten => _**., 1, Set(pickupgroup=${SIPPEER(${CALLERID(number)},pickupgroup)})
;# dobi vse dodatne pod interne
exten => _**., n, Set(all_peer_acc=${ODBC_ALL_PEER_ACC(${EXTEN:2})}) ;dobi vse pod stevilke
exten => _**., n, Set(i=1) ;i je ena ;)
exten => _**., n, Set(CALLED_NUM=SIP/${EXTEN:2}) ;primarna klicana je **exten
exten => _**., n, While($[${i}<$[${all_peer_acc}]]) ;gremo cez vse pod stevilke
exten => _**., n, Set(CALLED_NUM=${CALLED_NUM}&SIP/${EXTEN:2}${i})
exten => _**., n, Set(i=$[${i}+1])
exten => _**., n, EndWhile
;# kanc
exten => _**., n, Set(callgroup=${SIPPEER(${EXTEN:2},callgroup)})
exten => _**., n, GoToIF($["${callgroup}"=""]?hangup)
exten => _**., n, Set(pickup_groups=${FIELDQTY(pickupgroup,\,)})
exten => _**., n, Set(i=1)
exten => _**., n, While($[${i}<$[${pickup_groups}+1]])
exten => _**., n, Set(test_group=${CUT(pickupgroup,\,,${i}) })
exten => _**., n, GoToIf($[${test_group}=${callgroup}]?pickup)
exten => _**., n, Set(i=$[${i}+1])
exten => _**., n, EndWhile
exten => _**., n(hangup), HangUp()
exten => _**., n(pickup), Set(DIALED_NUMBER=${EXTEN:2})
exten => _**., n,  PickupChan(${CALLED_NUM})
exten => _**., n,  HangUp()

I do not use pickup mark in features.conf, instead I have special dialplan for picking up. This is because when user wants to pick-up call, he will know which call he will pickup. With pickup in features.conf  user pickups the last incoming call in callgroup.

The problem still exists, i overcome it with correction in chan_sip.c.
In asterisk 1.6.1.X worked all well.

@alecdavis, when i use this correction in chan_sip the transfer call and holding it worked.



By: Alec Davis (alecdavis) 2010-08-12 17:17:51

urosh: correct, your change to chan_sip causes the old behaviour, the BLF button won't do a subscripition based pickup, it will cause the pickup to use the dialplan, and as it's going through the dialplan, the HOLD and TRANSFER work.

But using the subscription based pickup, 'magic_pickup' as referred to in code, thats when you'll later have problems with HOLD and TRANSFER.

What works for us without using the PICKMARK, is that the blf hints and the phone's context have to be the same.<pre>
test*CLI> sip show subscriptions
Peer           User    Call ID         Extension    Last state Type            Mailbox Expiry
192.168.5.141  GXP0001 b35a38dcf3bee94 8626@trusted InUse      dialog-info+xml <none>  000300
192.168.5.129  GXP0013 4a3f410f48d195a 8612@trusted Idle       dialog-info+xml <none>  003600
2 active SIP subscriptions

test*CLI> core show hints

-= Registered Asterisk Dial Plan Hints =-
              8626@trusted             : SIP/GXP0013           State:InUse           Watchers  1
              8612@trusted             : SIP/GXP0001           State:Idle            Watchers  1</pre>



By: uros gaber (urosh) 2010-08-13 03:06:17

@alecdavis: Sorry, maybe i weren't enough clear in previous post. I were using the original source code (1.6.2.9) when I tested this. Your solution is OK, but i don't want to change my dialplan.

By: David Vossel (dvossel) 2010-08-13 13:42:16

I understand the issue now and am committing a modified version of your patch.

Now, the magic pickup only occurs if you are using 'notifycid'.  if 'notifycid=no' you should have your previous behavior restored.

By: Digium Subversion (svnbot) 2010-08-13 13:55:04

Repository: asterisk
Revision: 282235

U   branches/1.6.2/channels/chan_sip.c

------------------------------------------------------------------------
r282235 | dvossel | 2010-08-13 13:54:59 -0500 (Fri, 13 Aug 2010) | 16 lines

only do magic pickup when notifycid is enabled

A new way of doing BLF pickup was introduced into 1.6.2.  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 should only be enabled
when the new 'notifycid' option is set... but this was not the case.  Instead
the call-id value was included for every RINGING Notify message, which
caused a regression for people who used other methods for call pickup.

(closes issue ASTERISK-16356)
Reported by: urosh
Patches:
     chan_sip.txt uploaded by urosh (license )
     blf_cid_issue.diff uploaded by dvossel (license 671)
Tested by: dvossel, urosh, okrief, alecdavis

------------------------------------------------------------------------

http://svn.digium.com/view/asterisk?view=rev&revision=282235

By: Digium Subversion (svnbot) 2010-08-13 13:58:17

Repository: asterisk
Revision: 282236

_U  branches/1.8/
U   branches/1.8/channels/chan_sip.c

------------------------------------------------------------------------
r282236 | dvossel | 2010-08-13 13:58:15 -0500 (Fri, 13 Aug 2010) | 23 lines

Merged revisions 282235 via svnmerge from
https://origsvn.digium.com/svn/asterisk/branches/1.6.2

........
 r282235 | dvossel | 2010-08-13 13:54:53 -0500 (Fri, 13 Aug 2010) | 16 lines
 
 only do magic pickup when notifycid is enabled
 
 A new way of doing BLF pickup was introduced into 1.6.2.  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 should only be enabled
 when the new 'notifycid' option is set... but this was not the case.  Instead
 the call-id value was included for every RINGING Notify message, which
 caused a regression for people who used other methods for call pickup.
 
 (closes issue ASTERISK-16356)
 Reported by: urosh
 Patches:
       chan_sip.txt uploaded by urosh (license )
       blf_cid_issue.diff uploaded by dvossel (license 671)
 Tested by: dvossel, urosh, okrief, alecdavis
........

------------------------------------------------------------------------

http://svn.digium.com/view/asterisk?view=rev&revision=282236

By: Digium Subversion (svnbot) 2010-08-13 13:58:51

Repository: asterisk
Revision: 282237

_U  trunk/
U   trunk/channels/chan_sip.c

------------------------------------------------------------------------
r282237 | dvossel | 2010-08-13 13:58:50 -0500 (Fri, 13 Aug 2010) | 30 lines

Merged revisions 282236 via svnmerge from
https://origsvn.digium.com/svn/asterisk/branches/1.8

................
 r282236 | dvossel | 2010-08-13 13:58:10 -0500 (Fri, 13 Aug 2010) | 23 lines
 
 Merged revisions 282235 via svnmerge from
 https://origsvn.digium.com/svn/asterisk/branches/1.6.2
 
 ........
   r282235 | dvossel | 2010-08-13 13:54:53 -0500 (Fri, 13 Aug 2010) | 16 lines
   
   only do magic pickup when notifycid is enabled
   
   A new way of doing BLF pickup was introduced into 1.6.2.  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 should only be enabled
   when the new 'notifycid' option is set... but this was not the case.  Instead
   the call-id value was included for every RINGING Notify message, which
   caused a regression for people who used other methods for call pickup.
   
   (closes issue ASTERISK-16356)
   Reported by: urosh
   Patches:
         chan_sip.txt uploaded by urosh (license )
         blf_cid_issue.diff uploaded by dvossel (license 671)
   Tested by: dvossel, urosh, okrief, alecdavis
 ........
................

------------------------------------------------------------------------

http://svn.digium.com/view/asterisk?view=rev&revision=282237