aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--channels/chan_sip.c39
1 files changed, 19 insertions, 20 deletions
diff --git a/channels/chan_sip.c b/channels/chan_sip.c
index a255c0d4c..99f9e87aa 100644
--- a/channels/chan_sip.c
+++ b/channels/chan_sip.c
@@ -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 */