From: Joshua Colp Date: Wed, 21 Mar 2007 03:33:57 +0000 (+0000) Subject: Minor tweak. Only queue up an unhold control frame if we are actually on hold. This... X-Git-Tag: 1.6.0-beta1~3^2~2978 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=af9c17025f31e683851b98535cafc03cd2da86b5;p=thirdparty%2Fasterisk.git Minor tweak. Only queue up an unhold control frame if we are actually on hold. This would have shown itself when a call was initially being setup and the SDP data was being parsed in. git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@59083 65c4cc65-6c06-0410-ace0-fbb531ad65f3 --- diff --git a/channels/chan_sip.c b/channels/chan_sip.c index 758d282483..07e509954f 100644 --- a/channels/chan_sip.c +++ b/channels/chan_sip.c @@ -5644,11 +5644,22 @@ static int process_sdp(struct sip_pvt *p, struct sip_request *req) ast_set_write_format(p->owner, p->owner->writeformat); } - if (sin.sin_addr.s_addr && (!sendonly || sendonly == -1)) { + if (ast_test_flag(&p->flags[1], SIP_PAGE2_CALL_ONHOLD) && sin.sin_addr.s_addr && (!sendonly || sendonly == -1)) { ast_queue_control(p->owner, AST_CONTROL_UNHOLD); /* Activate a re-invite */ ast_queue_frame(p->owner, &ast_null_frame); - } else if (!sin.sin_addr.s_addr || sendonly) { + /* Queue Manager Unhold event */ + append_history(p, "Unhold", "%s", req->data); + if (global_callevents) + manager_event(EVENT_FLAG_CALL, "Unhold", + "Channel: %s\r\n" + "Uniqueid: %s\r\n", + p->owner->name, + p->owner->uniqueid); + if (global_notifyhold) + sip_peer_hold(p, FALSE); + ast_clear_flag(&p->flags[1], SIP_PAGE2_CALL_ONHOLD); /* Clear both flags */ + } else if (!sin.sin_addr.s_addr || (sendonly && sendonly != -1)) { ast_queue_control_data(p->owner, AST_CONTROL_HOLD, S_OR(p->mohsuggest, NULL), !ast_strlen_zero(p->mohsuggest) ? strlen(p->mohsuggest) + 1 : 0); @@ -5657,32 +5668,14 @@ static int process_sdp(struct sip_pvt *p, struct sip_request *req) /* RTCP needs to go ahead, even if we're on hold!!! */ /* Activate a re-invite */ ast_queue_frame(p->owner, &ast_null_frame); - } - - /* Manager Hold and Unhold events must be generated, if necessary */ - if (sin.sin_addr.s_addr && (!sendonly || sendonly == -1)) { - if (ast_test_flag(&p->flags[1], SIP_PAGE2_CALL_ONHOLD)) { - append_history(p, "Unhold", "%s", req->data); - if (global_callevents) - manager_event(EVENT_FLAG_CALL, "Unhold", - "Channel: %s\r\n" - "Uniqueid: %s\r\n", - p->owner->name, - p->owner->uniqueid); - if (global_notifyhold) - sip_peer_hold(p, FALSE); - } - ast_clear_flag(&p->flags[1], SIP_PAGE2_CALL_ONHOLD); /* Clear both flags */ - } else if (!sin.sin_addr.s_addr || sendonly ) { - /* No address for RTP, we're on hold */ + /* Queue Manager Hold event */ append_history(p, "Hold", "%s", req->data); - if (global_callevents && !ast_test_flag(&p->flags[1], SIP_PAGE2_CALL_ONHOLD)) { manager_event(EVENT_FLAG_CALL, "Hold", - "Channel: %s\r\n" - "Uniqueid: %s\r\n", - p->owner->name, - p->owner->uniqueid); + "Channel: %s\r\n" + "Uniqueid: %s\r\n", + p->owner->name, + p->owner->uniqueid); } if (sendonly == 1) /* One directional hold (sendonly/recvonly) */ ast_set_flag(&p->flags[1], SIP_PAGE2_CALL_ONHOLD_ONEDIR);