aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorfile <file@f38db490-d61c-443f-a65b-d21fe96a405b>2006-08-16 15:34:50 +0000
committerfile <file@f38db490-d61c-443f-a65b-d21fe96a405b>2006-08-16 15:34:50 +0000
commita2341795944cdb56217d2b5c0bbe0db5f430b4cc (patch)
tree8ea3742398591900b7d69bbcf01d03afae4ca260
parente57f314dc87a1efc863824f290ce8abfa5d3f752 (diff)
Move things around a bit more for onhold support, and add a check to only decrement the onhold variable if it's greater then 0. (issue #7740 reported by AuPix)
git-svn-id: http://svn.digium.com/svn/asterisk/trunk@40010 f38db490-d61c-443f-a65b-d21fe96a405b
-rw-r--r--channels/chan_sip.c35
1 files changed, 14 insertions, 21 deletions
diff --git a/channels/chan_sip.c b/channels/chan_sip.c
index 9e5493d07..33758d3d3 100644
--- a/channels/chan_sip.c
+++ b/channels/chan_sip.c
@@ -4926,29 +4926,21 @@ static int process_sdp(struct sip_pvt *p, struct sip_request *req)
bridgepeer = ast_bridged_channel(p->owner);
/* Turn on/off music on hold if we are holding/unholding */
- if (sin.sin_addr.s_addr && !sendonly) {
- /* Update peer state */
- sip_peer_hold(p, 0);
- if (bridgepeer)
+ if ((bridgepeer = ast_bridged_channel(p->owner))) {
+ if (sin.sin_addr.s_addr && !sendonly) {
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) {
- /* Update peer state */
- sip_peer_hold(p, 1);
- /* No address for RTP, we're on hold */
- if (bridgepeer)
+ /* Activate a re-invite */
+ ast_queue_frame(p->owner, &ast_null_frame);
+ } else if (!sin.sin_addr.s_addr || sendonly) {
ast_queue_control_data(p->owner, AST_CONTROL_HOLD,
S_OR(p->mohsuggest, NULL),
!ast_strlen_zero(p->mohsuggest) ? strlen(p->mohsuggest) + 1 : 0);
-
- if (sendonly)
- ast_rtp_stop(p->rtp);
- /* RTCP needs to go ahead, even if we're on hold!!! */
-
- /* Activate a re-invite */
- ast_queue_frame(p->owner, &ast_null_frame);
+ if (sendonly)
+ ast_rtp_stop(p->rtp);
+ /* 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 */
@@ -4961,7 +4953,7 @@ static int process_sdp(struct sip_pvt *p, struct sip_request *req)
"Uniqueid: %s\r\n",
p->owner->name,
p->owner->uniqueid);
-
+ sip_peer_hold(p, 0);
}
ast_clear_flag(&p->flags[1], SIP_PAGE2_CALL_ONHOLD); /* Clear both flags */
} else if (!sin.sin_addr.s_addr || sendonly ) {
@@ -4979,6 +4971,7 @@ static int process_sdp(struct sip_pvt *p, struct sip_request *req)
ast_set_flag(&p->flags[1], SIP_PAGE2_CALL_ONHOLD_ONEDIR);
else if (sendonly == 2) /* Inactive stream */
ast_set_flag(&p->flags[1], SIP_PAGE2_CALL_ONHOLD_INACTIVE);
+ sip_peer_hold(p, 1);
}
return 0;
@@ -7800,7 +7793,7 @@ static void sip_peer_hold(struct sip_pvt *p, int hold)
/* If they put someone on hold, increment the value... otherwise decrement it */
if (hold)
peer->onHold++;
- else
+ else if (hold > 0)
peer->onHold--;
/* Request device state update */