[svn-commits] kpfleming: branch kpfleming/sofiasdp r131016 - /team/kpfleming/sofiasdp/chann...
SVN commits to the Digium repositories
svn-commits at lists.digium.com
Tue Jul 15 13:16:33 CDT 2008
Author: kpfleming
Date: Tue Jul 15 13:16:32 2008
New Revision: 131016
URL: http://svn.digium.com/view/asterisk?view=rev&rev=131016
Log:
well, i can now pass the SDP to the parser, successfully parse it, and regenerate it in 'canonical' form without problems, so that appears to be progress :-)
Modified:
team/kpfleming/sofiasdp/channels/chan_sip.c
Modified: team/kpfleming/sofiasdp/channels/chan_sip.c
URL: http://svn.digium.com/view/asterisk/team/kpfleming/sofiasdp/channels/chan_sip.c?view=diff&rev=131016&r1=131015&r2=131016
==============================================================================
--- team/kpfleming/sofiasdp/channels/chan_sip.c (original)
+++ team/kpfleming/sofiasdp/channels/chan_sip.c Tue Jul 15 13:16:32 2008
@@ -1904,8 +1904,10 @@
/*--- Codec handling / SDP */
static void try_suggested_sip_codec(struct sip_pvt *p);
+#if 0
static const char* get_sdp_iterate(int* start, struct sip_request *req, const char *name);
static const char *get_sdp(struct sip_request *req, const char *name);
+#endif
static int find_sdp(struct sip_request *req);
static int process_sdp(struct sip_pvt *p, struct sip_request *req, int t38action);
static void add_codec_to_sdp(const struct sip_pvt *p, int codec, int sample_rate,
@@ -5637,6 +5639,7 @@
return "";
}
+#if 0
/*! \brief Lookup 'name' in the SDP starting
* at the 'start' line. Returns the matching line, and 'start'
* is updated with the next line number.
@@ -5653,7 +5656,9 @@
return "";
}
-
+#endif
+
+#if 0
/*! \brief Get a line from an SDP message body */
static const char *get_sdp(struct sip_request *req, const char *name)
{
@@ -5661,6 +5666,7 @@
return get_sdp_iterate(&dummy, req, name);
}
+#endif
/*! \brief Get a specific line from the message body */
static char *get_body(struct sip_request *req, char *name)
@@ -6538,6 +6544,46 @@
*/
static int process_sdp(struct sip_pvt *p, struct sip_request *req, int t38action)
{
+ unsigned int x;
+ char *c;
+ su_home_t *su_home = su_home_create();
+ sdp_parser_t *sdp;
+ sdp_session_t *session;
+ sdp_printer_t *printer;
+
+ /* reassemble the SDP into a continuous string; we know all of these lines
+ were originally consecutive and that they ended with '\r\n' pairs, so
+ we can safely put it back without having to worry about memory allocation
+ */
+ for (x = req->sdp_start; x <= req->sdp_end; x++) {
+ c = req->line[x] + strlen(req->line[x]);
+ *c++ = '\r';
+ *c++ = '\n';
+ }
+
+ sdp = sdp_parse(su_home, req->line[req->sdp_start], req->line[req->sdp_end] + strlen(req->line[req->sdp_end]) + 1 - req->line[req->sdp_start], 0);
+
+ if (!(session = sdp_session(sdp))) {
+ ast_log(LOG_WARNING, "SDP parsing failed: %s\n", sdp_parsing_error(sdp));
+ sdp_parser_free(sdp);
+ su_home_unref(su_home);
+ return -1;
+ }
+
+ printer = sdp_print(su_home, session, NULL, 0, 0);
+
+ if (sdp_message(printer)) {
+ ast_log(LOG_DEBUG, "Parsed and regenerated SDP is:\n%s\n", sdp_message(printer));
+ }
+
+ sdp_printer_free(printer);
+ sdp_parser_free(sdp);
+
+ su_home_unref(su_home);
+
+ return -1;
+
+#if 0
const char *m; /* SDP media offer */
const char *c;
const char *a;
@@ -7289,6 +7335,7 @@
}
return 0;
+#endif
}
#ifdef LOW_MEMORY
More information about the svn-commits
mailing list