Review Board 1.7.16


Fix directed group pickup feature code *8 with pickupsounds enabled , deadlock and segfault, affects 1.8.0 and trunk

Review Request #1185 - Created April 17, 2011 and submitted

Alec Davis
trunk
18654
Reviewers
asterisk-dev
rmudgett
Asterisk
Since 1.8, the new pickupsound and pickupfailsound in features.conf cause many issues.

1). chan_sip:handle_request_invite() shouldn't be playing out the fail/success audio, as it has 'netlock' locked.
2). dialplan applications for directed_pickups shouldn't beep.
3). feature code for directed pickup should beep on success/failure if configured.

Moved app_directed:pickup_do() to features:ast_do_pickup().

Functions below, all now use the new ast_do_pickup()
app_directed_pickup.c:
   pickup_by_channel()
   pickup_by_exten()
   pickup_by_mark()
   pickup_by_part()
features.c:
   ast_pickup_call()

Created a sip_pickup() thread to handle the pickup and playout the audio, spawned from handle_request_invite.
pickup using *8 feature code, with pickup sounds enabled/disabled

exten => 71,1,Pickup()           ; any ringing extension in same pickupgroup 
exten => 72,1,Pickup(85@phones)  ; dahdi extension
exten => 73,1,Pickup(823@phones) ; sip extension

Changes between revision 14 and 15

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16

  1. trunk/channels/chan_sip.c: Loading...
  2. trunk/main/features.c: Loading...
trunk/channels/chan_sip.c
Diff Revision 14 Diff Revision 15
[20] 22318 lines
[+20] [+] static int handle_request_invite(struct sip_pvt *p, struct sip_request *req, int debug, int seqno, struct ast_sockaddr *addr, int *recount, const char *e, int *nounlock)
22319

    
   
22319

   
22320
				if (result) {
22320
				if (result) {
22321

    
   
22321

   
22322
					/* Unlock locks so ast_hangup can do its magic */
22322
					/* Unlock locks so ast_hangup can do its magic */
22323
					ast_channel_unlock(c);
22323
					ast_channel_unlock(c);

    
   
22324
					*nounlock = 1;
22324
					sip_pvt_unlock(p);
22325
					sip_pvt_unlock(p);
22325
					ast_hangup(c);
22326
					ast_hangup(c);
22326
					sip_pvt_lock(p);
22327
					sip_pvt_lock(p);
22327
					c = NULL;
22328
					c = NULL;
22328
				}
22329
				}
22329
			} else {	/* Pickup call in call group */
22330
			} else {	/* Pickup call in call group */
22330
				if (sip_pickup(c)) {
22331
				if (sip_pickup(c)) {
22331
					ast_log(LOG_WARNING, "Failed to start Group pickup by %s\n", c->name);
22332
					ast_log(LOG_WARNING, "Failed to start Group pickup by %s\n", c->name);
22332
					transmit_response_reliable(p, "480 Temporarily Unavailable", req);
22333
					transmit_response_reliable(p, "480 Temporarily Unavailable", req);
22333
					sip_alreadygone(p);
22334
					sip_alreadygone(p);
22334
					c->hangupcause = AST_CAUSE_FAILURE;
22335
					c->hangupcause = AST_CAUSE_FAILURE;
22335

    
   
22336

   
22336
					/* Unlock locks so ast_hangup can do its magic */
22337
					/* Unlock locks so ast_hangup can do its magic */
22337
					if (!reinvite) {

   
22338
						/* If initial INVITE then c is locked.

   
22339
						 * If re-INVITE then c is not locked.

   
22340
						 */

   
22341
						ast_channel_unlock(c);
22338
					ast_channel_unlock(c);
22342
						*nounlock = 1;
22339
					*nounlock = 1;
22343
					}

   
22344

    
   
22340

   
22345
					p->invitestate = INV_COMPLETED;
22341
					p->invitestate = INV_COMPLETED;
22346
					sip_pvt_unlock(p);
22342
					sip_pvt_unlock(p);
22347
					ast_hangup(c);
22343
					ast_hangup(c);
22348
					sip_pvt_lock(p);
22344
					sip_pvt_lock(p);
[+20] [20] 7313 lines
trunk/main/features.c
Diff Revision 14 Diff Revision 15
 
  1. trunk/channels/chan_sip.c: Loading...
  2. trunk/main/features.c: Loading...

https://reviewboard.asterisk.org/ runs on a server provided by Digium, Inc. and uses bandwidth donated to the open source Asterisk community by API Digital Communications in Huntsville, AL USA.
Please report problems with this site to asteriskteam@digium.com.