]> git.ipfire.org Git - thirdparty/asterisk.git/commitdiff
When a new source of audio comes in (such as music on hold) make sure the marker...
authorJoshua Colp <jcolp@digium.com>
Tue, 4 Mar 2008 18:05:28 +0000 (18:05 +0000)
committerJoshua Colp <jcolp@digium.com>
Tue, 4 Mar 2008 18:05:28 +0000 (18:05 +0000)
(closes issue #10355)
Reported by: wdecarne
Patches:
      10355.diff uploaded by file (license 11)
(closes issue #11491)
Reported by: kanderson

git-svn-id: https://origsvn.digium.com/svn/asterisk/branches/1.4@105674 65c4cc65-6c06-0410-ace0-fbb531ad65f3

channels/chan_sip.c
include/asterisk/rtp.h
main/rtp.c

index 5873fe07b9a5710806ab73adfe7ff9a2b8053bc1..994a4c964e5b9d7b4be7c2614a9d44e471d0f4b8 100644 (file)
@@ -3661,8 +3661,10 @@ static int sip_answer(struct ast_channel *ast)
                        if (option_debug > 1)
                                ast_log(LOG_DEBUG,"T38State change to %d on channel %s\n", p->t38.state, ast->name);
                        res = transmit_response_with_t38_sdp(p, "200 OK", &p->initreq, XMIT_CRITICAL);
-               } else 
+               } else {
+                       ast_rtp_new_source(p->rtp);
                        res = transmit_response_with_sdp(p, "200 OK", &p->initreq, XMIT_CRITICAL);
+               }
        }
        ast_mutex_unlock(&p->lock);
        return res;
@@ -3695,6 +3697,7 @@ static int sip_write(struct ast_channel *ast, struct ast_frame *frame)
                                if ((ast->_state != AST_STATE_UP) &&
                                    !ast_test_flag(&p->flags[0], SIP_PROGRESS_SENT) &&
                                    !ast_test_flag(&p->flags[0], SIP_OUTGOING)) {
+                                       ast_rtp_new_source(p->rtp);
                                        transmit_response_with_sdp(p, "183 Session Progress", &p->initreq, XMIT_UNRELIABLE);
                                        ast_set_flag(&p->flags[0], SIP_PROGRESS_SENT);  
                                }
@@ -3920,9 +3923,11 @@ static int sip_indicate(struct ast_channel *ast, int condition, const void *data
                res = -1;
                break;
        case AST_CONTROL_HOLD:
+               ast_rtp_new_source(p->rtp);
                ast_moh_start(ast, data, p->mohinterpret);
                break;
        case AST_CONTROL_UNHOLD:
+               ast_rtp_new_source(p->rtp);
                ast_moh_stop(ast);
                break;
        case AST_CONTROL_VIDUPDATE:     /* Request a video frame update */
index 1ffa04d0d287090eda5b697d35c0c459abd56c5c..870529e5dca5823754caeef7a4410fc35b84c2aa 100644 (file)
@@ -162,6 +162,8 @@ int ast_rtp_sendcng(struct ast_rtp *rtp, int level);
 
 int ast_rtp_settos(struct ast_rtp *rtp, int tos);
 
+void ast_rtp_new_source(struct ast_rtp *rtp);
+
 /*! \brief  Setting RTP payload types from lines in a SDP description: */
 void ast_rtp_pt_clear(struct ast_rtp* rtp);
 /*! \brief Set payload types to defaults */
index a1aa2985f33cddbf199c115a1d2adb3c1c354e65..d75fe4852e504bfeac43d016bcdf39d8cfbd1384 100644 (file)
@@ -172,6 +172,7 @@ struct ast_rtp {
        struct ast_rtcp *rtcp;
        struct ast_codec_pref pref;
        struct ast_rtp *bridged;        /*!< Who we are Packet bridged to */
+       int set_marker_bit:1;           /*!< Whether to set the marker bit or not */
 };
 
 /* Forward declarations */
@@ -1994,6 +1995,12 @@ int ast_rtp_settos(struct ast_rtp *rtp, int tos)
        return res;
 }
 
+void ast_rtp_new_source(struct ast_rtp *rtp)
+{
+       rtp->set_marker_bit = 1;
+       return;
+}
+
 void ast_rtp_set_peer(struct ast_rtp *rtp, struct sockaddr_in *them)
 {
        rtp->them.sin_port = them->sin_port;
@@ -2641,6 +2648,13 @@ static int ast_rtp_raw_write(struct ast_rtp *rtp, struct ast_frame *f, int codec
                        }
                }
        }
+
+       /* If we have been explicitly told to set the marker bit do so */
+       if (rtp->set_marker_bit) {
+               mark = 1;
+               rtp->set_marker_bit = 0;
+       }
+
        /* If the timestamp for non-digit packets has moved beyond the timestamp
           for digits, update the digit timestamp.
        */