[asterisk-bugs] [Asterisk 0017097]: [patch] Pickup with Aastra phones: Unable to find subscription

Asterisk Bug Tracker noreply at bugs.digium.com
Wed May 26 17:23:43 CDT 2010


A NOTE has been added to this issue. 
====================================================================== 
https://issues.asterisk.org/view.php?id=17097 
====================================================================== 
Reported By:                ffossard
Assigned To:                dvossel
====================================================================== 
Project:                    Asterisk
Issue ID:                   17097
Category:                   Channels/chan_sip/Subscriptions
Reproducibility:            always
Severity:                   major
Priority:                   normal
Status:                     feedback
Target Version:             1.6.2.9
Asterisk Version:           1.6.2.6 
JIRA:                       SWP-1179 
Regression:                 No 
Reviewboard Link:            
SVN Branch (only for SVN checkouts, not tarball releases): N/A 
SVN Revision (number only!):  
Request Review:              
====================================================================== 
Date Submitted:             2010-03-26 06:14 CDT
Last Modified:              2010-05-26 17:23 CDT
====================================================================== 
Summary:                    [patch] Pickup with Aastra phones: Unable to find
subscription
Description: 
Hello

With Asterisk 1.6.2, the directed pickup don't works with Aastra phones
(53/55/57/30/31i)
It works good with 1.4, 1.6.0, 1.6.1, but not with 1.6.2
The blf works good.
The pickup works good with "*8 + number".

When I press a blinking button, there is only that in CLI, and no pickup
on the phone:
NOTICE[5161]: chan_sip.c:19843 handle_request_invite: Unable to find
subscription with call-id: fb287af6461e248a

the "sip show subscriptions" command return the good call-id:
localhost*CLI> sip show subscriptions
Peer             User             Call ID          Extension        Last
state     Type            Mailbox    Expiry
10.0.0.167       guillaume        fb287af6461e248  746 at blf          Idle  
        dialog-info+xml <none>     000360
2 active SIP subscription
Is the call-id truncated? (fb287af6461e248 => fb287af6461e248a )



I can "solve" the problem by replacing this two pieces of 1.6.2 chan_sip
by the same pièces of 1.6.1, this works but it's not a 

solution:

1.6.2:

if ((state & AST_EXTENSION_RINGING) && sip_cfg.notifyringing) {
	const char *local_display = p->exten;
	char *local_target = mto;
/* There are some limitations to how this works.  The primary one is that
the
callee must be dialing the same extension that is being monitored.  Simply
dialing
the hint'd device is not sufficient. */
if (sip_cfg.notifycid) {
	struct ast_channel *caller =
ast_channel_search_locked(find_calling_channel, p);
	if (caller) {
		int need = strlen(caller->cid.cid_num) + strlen(p->fromdomain) +
sizeof("sip:@");
		local_target = alloca(need);
		snprintf(local_target, need, "sip:%s@%s", caller->cid.cid_num,
p->fromdomain);
		local_display = ast_strdupa(caller->cid.cid_name);
		ast_channel_unlock(caller);
		caller = NULL;
	}
}
/* We create a fake call-id which the phone will send back in an INVITE
Replaces header which we can grab and do some magic with. */
ast_str_append(&tmp, 0, 
	"<dialog id=\"%s\" call-id=\"pickup-%s\" direction=\"recipient\">\n"
	"<remote>\n"
	/* See the limitations of this above.  Luckily the phone seems to still
be
	happy when these values are not correct. */
	"<identity display=\"%s\">%s</identity>\n"
	"<target uri=\"%s\"/>\n"
	"</remote>\n"
	"<local>\n"
	"<identity>%s</identity>\n"
	"<target uri=\"%s\"/>\n"
	"</local>\n",
	p->exten, p->callid, local_display, local_target, local_target, mto,
mto);
} else {
	ast_str_append(&tmp, 0, "<dialog id=\"%s\">\n", p->exten);
}


1.6.1:

if ((state & AST_EXTENSION_RINGING) && global_notifyringing)
	ast_str_append(&tmp, 0, "<dialog id=\"%s\" direction=\"recipient\">\n",
p->exten);
else
	ast_str_append(&tmp, 0, "<dialog id=\"%s\">\n", p->exten);






1.6.2:

/* Try to find call that we are replacing.
   If we have a Replaces header, we need to cancel that call if we succeed
with this call.
   First we cheat a little and look for a magic call-id from phones that
support
   dialog-info+xml so we can do technology independent pickup... */
if (strncmp(replace_id, "pickup-", 7) == 0) {
	struct sip_pvt *subscription = NULL;
	replace_id += 7; /* Worst case we are looking at \0 */
	if ((subscription = get_sip_pvt_byid_locked(replace_id, NULL, NULL)) ==
NULL) {
		ast_log(LOG_NOTICE, "Unable to find subscription with call-id: %s\n",
replace_id);
		transmit_response_reliable(p, "481 Call Leg Does Not Exist (Replaces)",
req);
		error = 1;
	} else {
		ast_log(LOG_NOTICE, "Trying to pick up %s@%s\n", subscription->exten,
subscription->context);
		ast_copy_string(pickup.exten, subscription->exten,
sizeof(pickup.exten));
		ast_copy_string(pickup.context, subscription->context,
sizeof(pickup.context));
		sip_pvt_unlock(subscription);
		if (subscription->owner) {
			ast_channel_unlock(subscription->owner);
		}
	}
}
/* This locks both refer_call pvt and refer_call pvt's owner!!!*/
if (!error && ast_strlen_zero(pickup.exten) && (p->refer->refer_call =
get_sip_pvt_byid_locked(replace_id, totag, fromtag)) == NULL) 

{
	ast_log(LOG_NOTICE, "Supervised transfer attempted to replace
non-existent call id (%s)!\n", replace_id);
	transmit_response_reliable(p, "481 Call Leg Does Not Exist (Replaces)",
req);
	error = 1;
} else {
	refer_locked = 1;
}


1.6.1:

/* Try to find call that we are replacing 
If we have a Replaces  header, we need to cancel that call if we succeed
with this call 
*/
if ((p->refer->refer_call = get_sip_pvt_byid_locked(replace_id, totag,
fromtag)) == NULL) {
	ast_log(LOG_NOTICE, "Supervised transfer attempted to replace
non-existent call id (%s)!\n", replace_id);
	transmit_response_reliable(p, "481 Call Leg Does Not Exist (Replaces)",
req);
	error = 1;
} else {
	refer_locked = 1;
}
/* At this point, bot the pvt and the owner of the call to be replaced is
locked */




I've searched and found news things about pickup with asterisk 1.6.2:
http://www.mail-archive.com/asterisk-users@lists.digium.com/msg234379.html
http://lists.digium.com/pipermail/asterisk-users/2010-February/244771.html
http://www.asterisk.org/doxygen/asterisk1.6.2/chan__sip_8c.html (search
"Unable to find subscription with call-id" in the page)



Maybe not really a bug, but a significant change which blocks an essential
feature.
====================================================================== 

---------------------------------------------------------------------- 
 (0122534) udosw (reporter) - 2010-05-26 17:23
 https://issues.asterisk.org/view.php?id=17097#c122534 
---------------------------------------------------------------------- 
This is amazing: Using the sip.conf like above and even with pedantic=yes
and with an unpatched 1.6.2.7 pickup works with a snom 300 phone (ext
346):

    -= Registered Asterisk Dial Plan Hints =-
                    347 at phones              : SIP/347              
State:Idle            Watchers  1
                   _XXX at phones              : SIP/${EXTEN}         
State:Unavailable     Watchers  0
----------------
- 2 hints registered

debian*CLI> 
  == Using SIP RTP CoS mark 5
    -- Executing [347 at phones:1] Dial("SIP/348-00000004", "SIP/347") in new
stack
  == Using SIP RTP CoS mark 5
    -- Called 347
  == Extension Changed 347[phones] new state Ringing for Notify User 346 
    -- SIP/347-00000005 is ringing
  == Using SIP RTP CoS mark 5
[May 27 00:16:30] NOTICE[7654]: chan_sip.c:19872 handle_request_invite:
Trying to pick up 347 at phones
[May 27 00:16:30] NOTICE[7654]: chan_sip.c:19872 handle_request_invite:
Trying to pick up 347 at phones
    -- SIP/346-00000006 answered SIP/348-00000004
    -- Native bridging SIP/348-00000004 and SIP/346-00000006
  == Extension Changed 347[phones] new state Idle for Notify User 346 

Will try with the ST2030 phone tomorrow. 

Issue History 
Date Modified    Username       Field                    Change               
====================================================================== 
2010-05-26 17:23 udosw          Note Added: 0122534                          
======================================================================




More information about the asterisk-bugs mailing list