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

Asterisk Bug Tracker noreply at bugs.digium.com
Wed May 26 12:01:13 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 12:01 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.
====================================================================== 

---------------------------------------------------------------------- 
 (0122503) dvossel (administrator) - 2010-05-26 12:01
 https://issues.asterisk.org/view.php?id=17097#c122503 
---------------------------------------------------------------------- 
Udsow, can you post your sip.conf and extensions.conf, or at least the
relevant parts here.

Based upon your debug information, this looks similar to a configuration
problem I had.  If you have 'notifycid=yes' in your sip.conf and the
'subscribecontext' is not the same as the peer's 'context', then the call
will not be found.  To do this you'd have to set 'notifycid=ignore-context'
and then you have to set the 'PICKUPMARK' channel variable correctly in the
dialplan for the extension you want to pickup.  This is further documented
in the sip.conf.sample file for the 'notifycid' option.

I've been testing this by setting 'notifycid=yes' and putting the hint in
the same context as the extension.  Below is an example of the config I'm
using and it works for me with my SNOM 370 even without the patch (with the
patch I can set pedantic=yes).  In this example, 222 calls 111.  The
snom370 subscribes to 111 and picks up the ringing 111 extension.

---extensions.conf---
[general]

[phones]
exten => 111,n,Dial(SIP/111)
exten => 111,hint,SIP/111

---sip.conf---

pedantic=no
notifyringing=yes
notifycid=yes
notifyhold=yes
limtonpeers=yes
callcounter=yes
disallow=all
allow=ulaw

[111]
type=friend
context=phones
host=dynamic
secret=xxx

[222]
type=friend
context=phones
host=dynamic
secret=xxx

[snom370]
type=friend
context=phones
host=dynamic
secret=xxx
allowsubscribe=yes
subscribecontext=phones 

Issue History 
Date Modified    Username       Field                    Change               
====================================================================== 
2010-05-26 12:01 dvossel        Note Added: 0122503                          
======================================================================




More information about the asterisk-bugs mailing list