[svn-commits] oej: branch oej/teapot-1.8 r402909 - in /team/oej/teapot-1.8: channels/ inclu...
SVN commits to the Digium repositories
svn-commits at lists.digium.com
Wed Nov 20 09:17:29 CST 2013
Author: oej
Date: Wed Nov 20 09:17:27 2013
New Revision: 402909
URL: http://svnview.digium.com/svn/asterisk?view=rev&rev=402909
Log:
Adding potential a=rtcp support
Added:
team/oej/teapot-1.8/patches/blackberry-a-rtcp-sdp-support-1.8.diff (with props)
Modified:
team/oej/teapot-1.8/channels/chan_sip.c
team/oej/teapot-1.8/include/asterisk/rtp_engine.h
team/oej/teapot-1.8/main/rtp_engine.c
team/oej/teapot-1.8/res/res_rtp_asterisk.c
Modified: team/oej/teapot-1.8/channels/chan_sip.c
URL: http://svnview.digium.com/svn/asterisk/team/oej/teapot-1.8/channels/chan_sip.c?view=diff&rev=402909&r1=402908&r2=402909
==============================================================================
--- team/oej/teapot-1.8/channels/chan_sip.c (original)
+++ team/oej/teapot-1.8/channels/chan_sip.c Wed Nov 20 09:17:27 2013
@@ -1319,6 +1319,7 @@
static int process_sdp_a_audio(const char *a, struct sip_pvt *p, struct ast_rtp_codecs *newaudiortp, int *last_rtpmap_codec);
static int process_sdp_a_video(const char *a, struct sip_pvt *p, struct ast_rtp_codecs *newvideortp, int *last_rtpmap_codec);
static int process_sdp_a_text(const char *a, struct sip_pvt *p, struct ast_rtp_codecs *newtextrtp, char *red_fmtp, int *red_num_gen, int *red_data_pt, int *last_rtpmap_codec);
+static int process_sdp_a_rtcp(const char *a, unsigned int *rtcpport);
static int process_sdp_a_image(const char *a, struct sip_pvt *p);
static void add_codec_to_sdp(const struct sip_pvt *p, format_t codec,
struct ast_str **m_buf, struct ast_str **a_buf,
@@ -9485,6 +9486,7 @@
/* Media stream specific parameters */
while ((type = get_sdp_line(&iterator, next - 1, req, &value)) != '\0') {
int processed = FALSE;
+ unsigned int rtcpport = 0;
switch (type) {
case 'c':
@@ -9520,6 +9522,9 @@
processed = TRUE;
} else if (process_sdp_a_audio(value, p, &newaudiortp, &last_rtpmap_codec)) {
processed = TRUE;
+ } else if (process_sdp_a_rtcp(value, &rtcpport)) {
+ ast_rtp_instance_set_remote_rtcp_port(p->rtp, rtcpport);
+ processed = TRUE;
}
}
/* Video specific scanning */
@@ -9528,6 +9533,9 @@
processed_crypto = TRUE;
processed = TRUE;
} else if (process_sdp_a_video(value, p, &newvideortp, &last_rtpmap_codec)) {
+ processed = TRUE;
+ } else if (process_sdp_a_rtcp(value, &rtcpport)) {
+ ast_rtp_instance_set_remote_rtcp_port(p->vrtp, rtcpport);
processed = TRUE;
}
}
@@ -9966,6 +9974,30 @@
if (*sendonly == -1)
*sendonly = 0;
found = TRUE;
+ }
+ return found;
+}
+
+/*! \brief Find rtcp header and change RTCP port for remote party */
+static int process_sdp_a_rtcp(const char *a, unsigned int *rtcpport)
+{
+ int found = FALSE;
+ char *tmp;
+ unsigned int port = 0;
+
+ if (strcasecmp(a, "rtcp")) {
+ return found;
+ }
+
+ tmp = strrchr(a, ':');
+ if (tmp) {
+ tmp++;
+ port = (unsigned int) atoi(tmp);
+ if (port > 0) {
+ ast_debug(2, "-- RTCP port set to %d (a=rtcp) \n", port);
+ *rtcpport = port;
+ found = TRUE;
+ }
}
return found;
}
Modified: team/oej/teapot-1.8/include/asterisk/rtp_engine.h
URL: http://svnview.digium.com/svn/asterisk/team/oej/teapot-1.8/include/asterisk/rtp_engine.h?view=diff&rev=402909&r1=402908&r2=402909
==============================================================================
--- team/oej/teapot-1.8/include/asterisk/rtp_engine.h (original)
+++ team/oej/teapot-1.8/include/asterisk/rtp_engine.h Wed Nov 20 09:17:27 2013
@@ -381,6 +381,8 @@
void (*packetization_set)(struct ast_rtp_instance *instance, struct ast_codec_pref *pref);
/*! Callback for setting the remote address that RTP is to be sent to */
void (*remote_address_set)(struct ast_rtp_instance *instance, struct ast_sockaddr *sa);
+ /*! Callback for setting the remote port that RTCP is to be sent to */
+ void (*remote_rtcp_port_set)(struct ast_rtp_instance *instance, unsigned int port);
/*! Callback for setting an alternate remote address */
void (*alt_remote_address_set)(struct ast_rtp_instance *instance, struct ast_sockaddr *sa);
/*! Callback for changing DTMF mode */
@@ -721,6 +723,16 @@
*/
int ast_rtp_instance_set_remote_address(struct ast_rtp_instance *instance, const struct ast_sockaddr *address);
+/*!
+ * \brief Change the RTCP port we're sending to the remote instance
+ *
+ * \retval 0 success
+ *
+ * This changes the port we are sending to (for instance when we find a=rtcp in a sdp)
+ * \since 1.8 Edvx
+ */
+int ast_rtp_instance_set_remote_rtcp_port(struct ast_rtp_instance *instance,
+ unsigned int port);
/*!
* \brief Set the address of an an alternate RTP address to receive from
Modified: team/oej/teapot-1.8/main/rtp_engine.c
URL: http://svnview.digium.com/svn/asterisk/team/oej/teapot-1.8/main/rtp_engine.c?view=diff&rev=402909&r1=402908&r2=402909
==============================================================================
--- team/oej/teapot-1.8/main/rtp_engine.c (original)
+++ team/oej/teapot-1.8/main/rtp_engine.c Wed Nov 20 09:17:27 2013
@@ -400,6 +400,16 @@
if (instance->engine->remote_address_set) {
instance->engine->remote_address_set(instance, &instance->remote_address);
+ }
+
+ return 0;
+}
+
+int ast_rtp_instance_set_remote_rtcp_port(struct ast_rtp_instance *instance,
+ unsigned int port)
+{
+ if (instance->engine->remote_rtcp_port_set) {
+ instance->engine->remote_rtcp_port_set(instance, port);
}
return 0;
Added: team/oej/teapot-1.8/patches/blackberry-a-rtcp-sdp-support-1.8.diff
URL: http://svnview.digium.com/svn/asterisk/team/oej/teapot-1.8/patches/blackberry-a-rtcp-sdp-support-1.8.diff?view=auto&rev=402909
==============================================================================
--- team/oej/teapot-1.8/patches/blackberry-a-rtcp-sdp-support-1.8.diff (added)
+++ team/oej/teapot-1.8/patches/blackberry-a-rtcp-sdp-support-1.8.diff Wed Nov 20 09:17:27 2013
@@ -1,0 +1,158 @@
+Index: channels/chan_sip.c
+===================================================================
+--- channels/chan_sip.c (.../branches/1.8) (revision 402908)
++++ channels/chan_sip.c (.../team/oej/blackberry-a-rtcp-sdp-support-1.8) (revision 402908)
+@@ -1314,6 +1314,7 @@
+ static int process_sdp_a_audio(const char *a, struct sip_pvt *p, struct ast_rtp_codecs *newaudiortp, int *last_rtpmap_codec);
+ static int process_sdp_a_video(const char *a, struct sip_pvt *p, struct ast_rtp_codecs *newvideortp, int *last_rtpmap_codec);
+ static int process_sdp_a_text(const char *a, struct sip_pvt *p, struct ast_rtp_codecs *newtextrtp, char *red_fmtp, int *red_num_gen, int *red_data_pt, int *last_rtpmap_codec);
++static int process_sdp_a_rtcp(const char *a, unsigned int *rtcpport);
+ static int process_sdp_a_image(const char *a, struct sip_pvt *p);
+ static void add_codec_to_sdp(const struct sip_pvt *p, format_t codec,
+ struct ast_str **m_buf, struct ast_str **a_buf,
+@@ -9562,6 +9563,7 @@
+ /* Media stream specific parameters */
+ while ((type = get_sdp_line(&iterator, next - 1, req, &value)) != '\0') {
+ int processed = FALSE;
++ unsigned int rtcpport = 0;
+
+ switch (type) {
+ case 'c':
+@@ -9597,6 +9599,9 @@
+ processed = TRUE;
+ } else if (process_sdp_a_audio(value, p, &newaudiortp, &last_rtpmap_codec)) {
+ processed = TRUE;
++ } else if (process_sdp_a_rtcp(value, &rtcpport)) {
++ ast_rtp_instance_set_remote_rtcp_port(p->rtp, rtcpport);
++ processed = TRUE;
+ }
+ }
+ /* Video specific scanning */
+@@ -9606,6 +9611,9 @@
+ processed = TRUE;
+ } else if (process_sdp_a_video(value, p, &newvideortp, &last_rtpmap_codec)) {
+ processed = TRUE;
++ } else if (process_sdp_a_rtcp(value, &rtcpport)) {
++ ast_rtp_instance_set_remote_rtcp_port(p->vrtp, rtcpport);
++ processed = TRUE;
+ }
+ }
+ /* Text (T.140) specific scanning */
+@@ -10047,6 +10055,30 @@
+ return found;
+ }
+
++/*! \brief Find rtcp header and change RTCP port for remote party */
++static int process_sdp_a_rtcp(const char *a, unsigned int *rtcpport)
++{
++ int found = FALSE;
++ char *tmp;
++ unsigned int port = 0;
++
++ if (strcasecmp(a, "rtcp")) {
++ return found;
++ }
++
++ tmp = strrchr(a, ':');
++ if (tmp) {
++ tmp++;
++ port = (unsigned int) atoi(tmp);
++ if (port > 0) {
++ ast_debug(2, "-- RTCP port set to %d (a=rtcp) \n", port);
++ *rtcpport = port;
++ found = TRUE;
++ }
++ }
++ return found;
++}
++
+ static int process_sdp_a_audio(const char *a, struct sip_pvt *p, struct ast_rtp_codecs *newaudiortp, int *last_rtpmap_codec)
+ {
+ int found = FALSE;
+Index: include/asterisk/rtp_engine.h
+===================================================================
+--- include/asterisk/rtp_engine.h (.../branches/1.8) (revision 402908)
++++ include/asterisk/rtp_engine.h (.../team/oej/blackberry-a-rtcp-sdp-support-1.8) (revision 402908)
+@@ -341,6 +341,8 @@
+ void (*packetization_set)(struct ast_rtp_instance *instance, struct ast_codec_pref *pref);
+ /*! Callback for setting the remote address that RTP is to be sent to */
+ void (*remote_address_set)(struct ast_rtp_instance *instance, struct ast_sockaddr *sa);
++ /*! Callback for setting the remote port that RTCP is to be sent to */
++ void (*remote_rtcp_port_set)(struct ast_rtp_instance *instance, unsigned int port);
+ /*! Callback for setting an alternate remote address */
+ void (*alt_remote_address_set)(struct ast_rtp_instance *instance, struct ast_sockaddr *sa);
+ /*! Callback for changing DTMF mode */
+@@ -672,6 +674,16 @@
+ */
+ int ast_rtp_instance_set_remote_address(struct ast_rtp_instance *instance, const struct ast_sockaddr *address);
+
++/*!
++ * \brief Change the RTCP port we're sending to the remote instance
++ *
++ * \retval 0 success
++ *
++ * This changes the port we are sending to (for instance when we find a=rtcp in a sdp)
++ * \since 1.8 Edvx
++ */
++int ast_rtp_instance_set_remote_rtcp_port(struct ast_rtp_instance *instance,
++ unsigned int port);
+
+ /*!
+ * \brief Set the address of an an alternate RTP address to receive from
+Index: main/rtp_engine.c
+===================================================================
+--- main/rtp_engine.c (.../branches/1.8) (revision 402908)
++++ main/rtp_engine.c (.../team/oej/blackberry-a-rtcp-sdp-support-1.8) (revision 402908)
+@@ -402,6 +402,16 @@
+ return 0;
+ }
+
++int ast_rtp_instance_set_remote_rtcp_port(struct ast_rtp_instance *instance,
++ unsigned int port)
++{
++ if (instance->engine->remote_rtcp_port_set) {
++ instance->engine->remote_rtcp_port_set(instance, port);
++ }
++
++ return 0;
++}
++
+ int ast_rtp_instance_set_alt_remote_address(struct ast_rtp_instance *instance,
+ const struct ast_sockaddr *address)
+ {
+Index: res/res_rtp_asterisk.c
+===================================================================
+--- res/res_rtp_asterisk.c (.../branches/1.8) (revision 402908)
++++ res/res_rtp_asterisk.c (.../team/oej/blackberry-a-rtcp-sdp-support-1.8) (revision 402908)
+@@ -284,6 +284,7 @@
+ static void ast_rtp_prop_set(struct ast_rtp_instance *instance, enum ast_rtp_property property, int value);
+ static int ast_rtp_fd(struct ast_rtp_instance *instance, int rtcp);
+ static void ast_rtp_remote_address_set(struct ast_rtp_instance *instance, struct ast_sockaddr *addr);
++static void ast_rtp_remote_rtcp_port_set(struct ast_rtp_instance *instance, unsigned int port);
+ static void ast_rtp_alt_remote_address_set(struct ast_rtp_instance *instance, struct ast_sockaddr *addr);
+ static int rtp_red_init(struct ast_rtp_instance *instance, int buffer_time, int *payloads, int generations);
+ static int rtp_red_buffer(struct ast_rtp_instance *instance, struct ast_frame *frame);
+@@ -312,6 +313,7 @@
+ .prop_set = ast_rtp_prop_set,
+ .fd = ast_rtp_fd,
+ .remote_address_set = ast_rtp_remote_address_set,
++ .remote_rtcp_port_set = ast_rtp_remote_rtcp_port_set,
+ .alt_remote_address_set = ast_rtp_alt_remote_address_set,
+ .red_init = rtp_red_init,
+ .red_buffer = rtp_red_buffer,
+@@ -2619,6 +2621,15 @@
+ return;
+ }
+
++static void ast_rtp_remote_rtcp_port_set(struct ast_rtp_instance *instance, unsigned int port)
++{
++ struct ast_rtp *rtp = ast_rtp_instance_get_data(instance);
++ if (!ast_sockaddr_isnull(&rtp->rtcp->them)) {
++ ast_sockaddr_set_port(&rtp->rtcp->them, port);
++ ast_debug(1, "Setting RTCP port on RTP instance '%p' to %d\n", instance, port);
++ }
++}
++
+ static void ast_rtp_alt_remote_address_set(struct ast_rtp_instance *instance, struct ast_sockaddr *addr)
+ {
+ struct ast_rtp *rtp = ast_rtp_instance_get_data(instance);
Propchange: team/oej/teapot-1.8/patches/blackberry-a-rtcp-sdp-support-1.8.diff
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: team/oej/teapot-1.8/patches/blackberry-a-rtcp-sdp-support-1.8.diff
------------------------------------------------------------------------------
svn:keywords = Author Date Id Revision
Propchange: team/oej/teapot-1.8/patches/blackberry-a-rtcp-sdp-support-1.8.diff
------------------------------------------------------------------------------
svn:mime-type = text/plain
Modified: team/oej/teapot-1.8/res/res_rtp_asterisk.c
URL: http://svnview.digium.com/svn/asterisk/team/oej/teapot-1.8/res/res_rtp_asterisk.c?view=diff&rev=402909&r1=402908&r2=402909
==============================================================================
--- team/oej/teapot-1.8/res/res_rtp_asterisk.c (original)
+++ team/oej/teapot-1.8/res/res_rtp_asterisk.c Wed Nov 20 09:17:27 2013
@@ -332,6 +332,7 @@
static void ast_rtp_prop_set(struct ast_rtp_instance *instance, enum ast_rtp_property property, int value);
static int ast_rtp_fd(struct ast_rtp_instance *instance, int rtcp);
static void ast_rtp_remote_address_set(struct ast_rtp_instance *instance, struct ast_sockaddr *addr);
+static void ast_rtp_remote_rtcp_port_set(struct ast_rtp_instance *instance, unsigned int port);
static void ast_rtp_alt_remote_address_set(struct ast_rtp_instance *instance, struct ast_sockaddr *addr);
static int rtp_red_init(struct ast_rtp_instance *instance, int buffer_time, int *payloads, int generations);
static int rtp_red_buffer(struct ast_rtp_instance *instance, struct ast_frame *frame);
@@ -369,6 +370,7 @@
.prop_set = ast_rtp_prop_set,
.fd = ast_rtp_fd,
.remote_address_set = ast_rtp_remote_address_set,
+ .remote_rtcp_port_set = ast_rtp_remote_rtcp_port_set,
.alt_remote_address_set = ast_rtp_alt_remote_address_set,
.red_init = rtp_red_init,
.red_buffer = rtp_red_buffer,
@@ -2985,6 +2987,15 @@
return;
}
+static void ast_rtp_remote_rtcp_port_set(struct ast_rtp_instance *instance, unsigned int port)
+{
+ struct ast_rtp *rtp = ast_rtp_instance_get_data(instance);
+ if (!ast_sockaddr_isnull(&rtp->rtcp->them)) {
+ ast_sockaddr_set_port(&rtp->rtcp->them, port);
+ ast_debug(1, "Setting RTCP port on RTP instance '%p' to %d\n", instance, port);
+ }
+}
+
static void ast_rtp_alt_remote_address_set(struct ast_rtp_instance *instance, struct ast_sockaddr *addr)
{
struct ast_rtp *rtp = ast_rtp_instance_get_data(instance);
More information about the svn-commits
mailing list