[svn-commits] branch oej/sdpcleanup r31635 - in
/team/oej/sdpcleanup: ./ channels/
svn-commits at lists.digium.com
svn-commits at lists.digium.com
Thu Jun 1 23:09:44 MST 2006
Author: oej
Date: Fri Jun 2 01:09:44 2006
New Revision: 31635
URL: http://svn.digium.com/view/asterisk?rev=31635&view=rev
Log:
Update
Modified:
team/oej/sdpcleanup/ (props changed)
team/oej/sdpcleanup/channel.c
team/oej/sdpcleanup/channels/chan_sip.c
Propchange: team/oej/sdpcleanup/
------------------------------------------------------------------------------
automerge = http://edvina.net/training/
Modified: team/oej/sdpcleanup/channel.c
URL: http://svn.digium.com/view/asterisk/team/oej/sdpcleanup/channel.c?rev=31635&r1=31634&r2=31635&view=diff
==============================================================================
--- team/oej/sdpcleanup/channel.c (original)
+++ team/oej/sdpcleanup/channel.c Fri Jun 2 01:09:44 2006
@@ -539,7 +539,7 @@
}
}
-/*! \brief Pick the best codec */
+/*! \brief Pick the best audio codec */
int ast_best_codec(int fmts)
{
/* This just our opinion, expressed in code. We are asked to choose
@@ -572,7 +572,9 @@
/*! Down to G.723.1 which is proprietary but at least designed for voice */
AST_FORMAT_G723_1,
};
-
+
+ /* Strip out video */
+ fmts &= AST_FORMAT_AUDIO_MASK;
/* Find the first preferred codec in the format given */
for (x=0; x < (sizeof(prefs) / sizeof(prefs[0]) ); x++)
Modified: team/oej/sdpcleanup/channels/chan_sip.c
URL: http://svn.digium.com/view/asterisk/team/oej/sdpcleanup/channels/chan_sip.c?rev=31635&r1=31634&r2=31635&view=diff
==============================================================================
--- team/oej/sdpcleanup/channels/chan_sip.c (original)
+++ team/oej/sdpcleanup/channels/chan_sip.c Fri Jun 2 01:09:44 2006
@@ -3250,7 +3250,10 @@
/*! \brief Initiate a call in the SIP channel
- called from sip_request_call (calls from the pbx ) */
+ called from sip_request_call (calls from the pbx ) for outbound channels
+ and from handle_request_invite for inbound channels
+
+*/
static struct ast_channel *sip_new(struct sip_pvt *i, int state, const char *title)
{
struct ast_channel *tmp;
@@ -3271,28 +3274,43 @@
/* Select our native format based on codec preference until we receive
something from another device to the contrary. */
- if (i->jointcapability)
+ if (i->jointcapability) /* The joint capabilities of us and peer */
what = i->jointcapability;
- else if (i->capability)
+ else if (i->capability) /* Our configured capability for this peer */
what = i->capability;
else
- what = global_capability;
-
+ what = global_capability; /* Global codec support */
+
+ /* Set the native formats for audio and merge in video */
tmp->nativeformats = ast_codec_choose(&i->prefs, what, 1) | (i->jointcapability & AST_FORMAT_VIDEO_MASK);
if (option_debug) {
char buf[BUFSIZ];
ast_log(LOG_DEBUG, "*** Our native formats are %s \n", ast_getformatname_multiple(buf, BUFSIZ, tmp->nativeformats));
- }
-
+ ast_log(LOG_DEBUG, "*** Joint capabilities are %s \n", ast_getformatname_multiple(buf, BUFSIZ, i->jointcapability));
+ ast_log(LOG_DEBUG, "*** Our capabilities are %s \n", ast_getformatname_multiple(buf, BUFSIZ, i->capability));
+ if (i->prefcodec)
+ ast_log(LOG_DEBUG, "*** Our preferred formats from the incoming channel are %s \n", ast_getformatname_multiple(buf, BUFSIZ, i->prefcodec));
+ }
+
+ /* XXX Why are we choosing a codec from the native formats?? */
fmt = ast_best_codec(tmp->nativeformats);
- needvideo = tmp->nativeformats & AST_FORMAT_VIDEO_MASK;
-
- if (option_debug) {
+ /* If we have a prefcodec setting, we have an inbound channel that set a
+ preferred format for this call. Otherwise, we check the jointcapability
+ We also check for vrtp. If it's not there, we are not allowed do any video anyway.
+ */
+ if (i->vrtp) {
+ if (i->prefcodec)
+ needvideo = i->prefcodec & AST_FORMAT_VIDEO_MASK; /* Outbound call */
+ else
+ needvideo = i->jointcapability & AST_FORMAT_VIDEO_MASK; /* Inbound call */
+ }
+
+ if (option_debug > 2) {
if (needvideo)
- ast_log(LOG_DEBUG, "This call can handle video! HOLLYWOOD next!\n");
+ ast_log(LOG_DEBUG, "This channel can handle video! HOLLYWOOD next!\n");
else
- ast_log(LOG_DEBUG, "This call will not be able to handle video.\n");
+ ast_log(LOG_DEBUG, "This channel will not be able to handle video.\n");
}
@@ -4054,7 +4072,7 @@
return 0;
}
-/*! \brief Process SIP SDP and activate RTP channels---*/
+/*! \brief Process SIP SDP and activate RTP channels */
static int process_sdp(struct sip_pvt *p, struct sip_request *req)
{
const char *m;
@@ -4079,13 +4097,13 @@
int iterator;
int sendonly = 0;
int numberofports;
- int debug=sip_debug_test_pvt(p);
struct ast_channel *bridgepeer = NULL;
struct ast_rtp newaudiortp, newvideortp; /* Buffers for codec handling */
int newjointcapability; /* Negotiated capability */
int newpeercapability;
int newnoncodeccapability;
int numberofmediastreams = 0;
+ int debug = sip_debug_test_pvt(p);
if (!p->rtp) {
ast_log(LOG_ERROR, "Got SDP but have no RTP session allocated.\n");
@@ -4211,7 +4229,8 @@
/* Setup audio port number */
sin.sin_port = htons(portno);
/* Setup video port number */
- vsin.sin_port = htons(vportno);
+ if (vportno != -1)
+ vsin.sin_port = htons(vportno);
/* Next, scan through each "a=rtpmap:" line, noting each
* specified RTP payload type (with corresponding MIME subtype):
@@ -4226,38 +4245,45 @@
} else if (!strcasecmp(a, "sendrecv")) {
sendonly = 0;
continue;
- } else if (!strcasecmp(a, "inactive")) {
- /* Inactive media streams: Not supported */
- if (debug)
- ast_verbose("Got unsupported a:inactive in SDP offer \n");
- continue;
- } else if (!strncasecmp(a, "fmtp:", (size_t) 5)) {
- /* Format parameters: Not supported */
- /* Note: This is used for codec parameters, like bitrate for
- G722 and video formats for H263 and H264
- See RFC2327 for an example */
- if (debug)
- ast_verbose("Got unsupported a:fmtp in SDP offer \n");
- continue;
- } else if (!strncasecmp(a, "framerate:", (size_t) 10)) {
- /* Video stuff: Not supported */
- if (debug)
- ast_verbose("Got unsupported a:framerate in SDP offer \n");
- continue;
- } else if (!strncasecmp(a, "maxprate:", (size_t) 9)) {
- /* Video stuff: Not supported */
- if (debug)
- ast_verbose("Got unsupported a:maxprate in SDP offer \n");
- continue;
- } else if (!strncasecmp(a, "crypto:", (size_t) 7)) {
- /* SRTP stuff, not yet supported */
- if (debug)
- ast_verbose("Got unsupported a:crypto in SDP offer \n");
- continue;
- } else if (!strncasecmp(a, "ptime:", (size_t) 6)) {
- if (debug)
- ast_verbose("Got unsupported a:ptime in SDP offer \n");
- continue;
+ } else if (option_debug) {
+ /* If we're debugging, check for unsupported sdp options */
+ if (!strcasecmp(a, "inactive")) {
+ /* Inactive media streams: Not supported */
+ if (debug)
+ ast_verbose("Got unsupported a:inactive in SDP offer \n");
+ continue;
+ } else if (!strncasecmp(a, "rtcp:", (size_t) 5)) {
+ if (debug)
+ ast_verbose("Got unsupported a:rtcp in SDP offer \n");
+ continue;
+ } else if (!strncasecmp(a, "fmtp:", (size_t) 5)) {
+ /* Format parameters: Not supported */
+ /* Note: This is used for codec parameters, like bitrate for
+ G722 and video formats for H263 and H264
+ See RFC2327 for an example */
+ if (debug)
+ ast_verbose("Got unsupported a:fmtp in SDP offer \n");
+ continue;
+ } else if (!strncasecmp(a, "framerate:", (size_t) 10)) {
+ /* Video stuff: Not supported */
+ if (debug)
+ ast_verbose("Got unsupported a:framerate in SDP offer \n");
+ continue;
+ } else if (!strncasecmp(a, "maxprate:", (size_t) 9)) {
+ /* Video stuff: Not supported */
+ if (debug)
+ ast_verbose("Got unsupported a:maxprate in SDP offer \n");
+ continue;
+ } else if (!strncasecmp(a, "crypto:", (size_t) 7)) {
+ /* SRTP stuff, not yet supported */
+ if (debug)
+ ast_verbose("Got unsupported a:crypto in SDP offer \n");
+ continue;
+ } else if (!strncasecmp(a, "ptime:", (size_t) 6)) {
+ if (debug)
+ ast_verbose("Got unsupported a:ptime in SDP offer \n");
+ continue;
+ }
} else if (sscanf(a, "rtpmap: %u %[^/]/", &codec, mimeSubtype) != 2)
continue;
/* We have a rtpmap to handle */
@@ -4343,7 +4369,7 @@
/* Ok, we're going with this offer */
if (option_debug > 1) {
char buf[BUFSIZ];
- ast_log(LOG_DEBUG, "We're settling with these formats: %s\n", ast_getformatname_multiple(buf, BUFSIZ, p->capability));
+ ast_log(LOG_DEBUG, "We're settling with these formats: %s\n", ast_getformatname_multiple(buf, BUFSIZ, p->jointcapability));
}
if (!p->owner) /* There's no open channel owning us so we can return here. For a re-invite or so, we proceed */
More information about the svn-commits
mailing list