mirror of
https://github.com/asterisk/asterisk.git
synced 2026-06-15 20:27:02 +00:00
Move check for codec translation to sip_call() instead of in add_sdp. No one bothers
with the result of add_sdp anyway... Yet... git-svn-id: https://origsvn.digium.com/svn/asterisk/branches/1.4@47015 65c4cc65-6c06-0410-ace0-fbb531ad65f3
This commit is contained in:
+19
-20
@@ -1269,7 +1269,7 @@ static void add_codec_to_sdp(const struct sip_pvt *p, int codec, int sample_rate
|
||||
static void add_noncodec_to_sdp(const struct sip_pvt *p, int format, int sample_rate,
|
||||
char **m_buf, size_t *m_size, char **a_buf, size_t *a_size,
|
||||
int debug);
|
||||
static int add_sdp(struct sip_request *resp, struct sip_pvt *p);
|
||||
static enum sip_result add_sdp(struct sip_request *resp, struct sip_pvt *p);
|
||||
|
||||
/*--- Authentication stuff */
|
||||
static int reply_digest(struct sip_pvt *p, struct sip_request *req, char *header, int sipmethod, char *digest, int digest_len);
|
||||
@@ -2783,16 +2783,21 @@ static int sip_call(struct ast_channel *ast, char *dest, int timeout)
|
||||
res = update_call_counter(p, INC_CALL_RINGING);
|
||||
if ( res != -1 ) {
|
||||
p->callingpres = ast->cid.cid_pres;
|
||||
p->jointcapability = p->capability;
|
||||
p->t38.jointcapability = p->t38.capability;
|
||||
if (option_debug)
|
||||
ast_log(LOG_DEBUG,"Our T38 capability (%d), joint T38 capability (%d)\n", p->t38.capability, p->t38.jointcapability);
|
||||
transmit_invite(p, SIP_INVITE, 1, 2);
|
||||
if (p->maxtime)
|
||||
p->jointcapability = ast_translate_available_formats(p->capability, p->prefcodec);
|
||||
|
||||
/* If there are no audio formats left to offer, punt */
|
||||
if (!(p->jointcapability & AST_FORMAT_AUDIO_MASK)) {
|
||||
ast_log(LOG_WARNING, "No audio format found to offer. Cancelling call to %s\n", p->username);
|
||||
res = -1;
|
||||
} else {
|
||||
p->t38.jointcapability = p->t38.capability;
|
||||
if (option_debug > 1)
|
||||
ast_log(LOG_DEBUG,"Our T38 capability (%d), joint T38 capability (%d)\n", p->t38.capability, p->t38.jointcapability);
|
||||
transmit_invite(p, SIP_INVITE, 1, 2);
|
||||
|
||||
/* Initialize auto-congest time */
|
||||
p->initid = ast_sched_add(sched, p->maxtime * 4, auto_congest, p);
|
||||
else
|
||||
p->initid = ast_sched_add(sched, SIP_TRANS_TIMEOUT, auto_congest, p);
|
||||
p->initid = ast_sched_add(sched, p->maxtime ? (p->maxtime * 4) : SIP_TRANS_TIMEOUT, auto_congest, p);
|
||||
}
|
||||
}
|
||||
return res;
|
||||
}
|
||||
@@ -5966,7 +5971,7 @@ static void add_noncodec_to_sdp(const struct sip_pvt *p, int format, int sample_
|
||||
}
|
||||
|
||||
/*! \brief Add Session Description Protocol message */
|
||||
static int add_sdp(struct sip_request *resp, struct sip_pvt *p)
|
||||
static enum sip_result add_sdp(struct sip_request *resp, struct sip_pvt *p)
|
||||
{
|
||||
int len = 0;
|
||||
int alreadysent = 0;
|
||||
@@ -6008,7 +6013,7 @@ static int add_sdp(struct sip_request *resp, struct sip_pvt *p)
|
||||
|
||||
if (!p->rtp) {
|
||||
ast_log(LOG_WARNING, "No way to add SDP without an RTP structure\n");
|
||||
return -1;
|
||||
return AST_FAILURE;
|
||||
}
|
||||
|
||||
/* Set RTP Session ID and version */
|
||||
@@ -6032,14 +6037,8 @@ static int add_sdp(struct sip_request *resp, struct sip_pvt *p)
|
||||
dest.sin_port = sin.sin_port;
|
||||
}
|
||||
|
||||
/* Ok, let's start working with codec selection here */
|
||||
capability = ast_translate_available_formats(p->jointcapability, p->prefcodec);
|
||||
capability = p->jointcapability;
|
||||
|
||||
/* If there are no audio formats left to offer, punt */
|
||||
if (!(capability & AST_FORMAT_AUDIO_MASK)) {
|
||||
ast_log(LOG_WARNING, "No audio format found to offer.\n");
|
||||
return -1;
|
||||
}
|
||||
|
||||
if (option_debug > 1) {
|
||||
char codecbuf[BUFSIZ];
|
||||
@@ -6221,7 +6220,7 @@ static int add_sdp(struct sip_request *resp, struct sip_pvt *p)
|
||||
ast_log(LOG_DEBUG, "Done building SDP. Settling with this capability: %s\n", ast_getformatname_multiple(buf, BUFSIZ, capability));
|
||||
}
|
||||
|
||||
return 0;
|
||||
return AST_SUCCESS;
|
||||
}
|
||||
|
||||
/*! \brief Used for 200 OK and 183 early media */
|
||||
|
||||
Reference in New Issue
Block a user