[asterisk-commits] oej: branch 1.4 r47015 -
/branches/1.4/channels/chan_sip.c
asterisk-commits at lists.digium.com
asterisk-commits at lists.digium.com
Thu Nov 2 12:56:30 MST 2006
Author: oej
Date: Thu Nov 2 13:56:30 2006
New Revision: 47015
URL: http://svn.digium.com/view/asterisk?rev=47015&view=rev
Log:
Move check for codec translation to sip_call() instead of in add_sdp. No one bothers
with the result of add_sdp anyway... Yet...
Modified:
branches/1.4/channels/chan_sip.c
Modified: branches/1.4/channels/chan_sip.c
URL: http://svn.digium.com/view/asterisk/branches/1.4/channels/chan_sip.c?rev=47015&r1=47014&r2=47015&view=diff
==============================================================================
--- branches/1.4/channels/chan_sip.c (original)
+++ branches/1.4/channels/chan_sip.c Thu Nov 2 13:56:30 2006
@@ -1269,7 +1269,7 @@
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 @@
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 @@
}
/*! \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 @@
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 @@
dest.sin_port = sin.sin_port;
}
- /* Ok, let's start working with codec selection here */
- capability = ast_translate_available_formats(p->jointcapability, p->prefcodec);
-
- /* 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;
- }
+ capability = p->jointcapability;
+
if (option_debug > 1) {
char codecbuf[BUFSIZ];
@@ -6221,7 +6220,7 @@
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 */
More information about the asterisk-commits
mailing list