summaryrefslogtreecommitdiff
path: root/channels
diff options
context:
space:
mode:
authorOlle Johansson <oej@edvina.net>2008-02-18 17:12:13 +0000
committerOlle Johansson <oej@edvina.net>2008-02-18 17:12:13 +0000
commitf04d5fb83dd36e600e1e257568ea3ca53154315e (patch)
treef5aaf9d24662a2613043f5482309de078e1bd121 /channels
parente9d0cda77d4b0ecdb1d954c24cdde6161638fbaf (diff)
Make sure we can set up calls without audio (text+video).
And ... it works! git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@103772 65c4cc65-6c06-0410-ace0-fbb531ad65f3
Diffstat (limited to 'channels')
-rw-r--r--channels/chan_sip.c22
1 files changed, 16 insertions, 6 deletions
diff --git a/channels/chan_sip.c b/channels/chan_sip.c
index 9d755c684..6f4ed046b 100644
--- a/channels/chan_sip.c
+++ b/channels/chan_sip.c
@@ -7804,6 +7804,7 @@ static enum sip_result add_sdp(struct sip_request *resp, struct sip_pvt *p, int
int x;
int capability;
+ int needaudio = FALSE;
int needvideo = FALSE;
int needtext = FALSE;
int debug = sip_debug_test_pvt(p);
@@ -7847,6 +7848,10 @@ static enum sip_result add_sdp(struct sip_request *resp, struct sip_pvt *p, int
}
#endif
+ /* Check if we need audio */
+ if (capability & AST_FORMAT_AUDIO_MASK)
+ needaudio = TRUE;
+
/* Check if we need video in this call */
if ((capability & AST_FORMAT_VIDEO_MASK) && !p->novideo) {
if (p->vrtp) {
@@ -7941,7 +7946,7 @@ static enum sip_result add_sdp(struct sip_request *resp, struct sip_pvt *p, int
alreadysent |= codec;
}
- /* Start by sending our preferred audio codecs */
+ /* Start by sending our preferred audio/video codecs */
for (x = 0; x < 32; x++) {
int codec;
@@ -8008,14 +8013,17 @@ static enum sip_result add_sdp(struct sip_request *resp, struct sip_pvt *p, int
a_audio->len - a_audio->used < 2 || a_video->len - a_video->used < 2)
ast_log(LOG_WARNING, "SIP SDP may be truncated due to undersized buffer!!\n");
- ast_str_append(&m_audio, 0, "\r\n");
+ if (needaudio)
+ ast_str_append(&m_audio, 0, "\r\n");
if (needvideo)
ast_str_append(&m_video, 0, "\r\n");
if (needtext)
ast_str_append(&m_text, 0, "\r\n");
len = strlen(version) + strlen(subject) + strlen(owner) +
- strlen(connection) + strlen(stime) + m_audio->used + a_audio->used + strlen(hold);
+ strlen(connection) + strlen(stime);
+ if (needaudio)
+ len += m_audio->used + a_audio->used + strlen(hold);
if (needvideo) /* only if video response is appropriate */
len += m_video->used + a_video->used + strlen(bandwidth) + strlen(hold);
if (needtext) /* only if text response is appropriate */
@@ -8030,9 +8038,11 @@ static enum sip_result add_sdp(struct sip_request *resp, struct sip_pvt *p, int
if (needvideo) /* only if video response is appropriate */
add_line(resp, bandwidth);
add_line(resp, stime);
- add_line(resp, m_audio->str);
- add_line(resp, a_audio->str);
- add_line(resp, hold);
+ if (needaudio) {
+ add_line(resp, m_audio->str);
+ add_line(resp, a_audio->str);
+ add_line(resp, hold);
+ }
if (needvideo) { /* only if video response is appropriate */
add_line(resp, m_video->str);
add_line(resp, a_video->str);