[Freeswitch-svn] [commit] r1881 - freeswitch/trunk/src/mod/endpoints/mod_exosip
Freeswitch SVN
anthm at freeswitch.org
Fri Jul 14 14:31:23 EDT 2006
Author: anthm
Date: Fri Jul 14 14:31:23 2006
New Revision: 1881
Modified:
freeswitch/trunk/src/mod/endpoints/mod_exosip/mod_exosip.c
Log:
add fmtp to sip
Modified: freeswitch/trunk/src/mod/endpoints/mod_exosip/mod_exosip.c
==============================================================================
--- freeswitch/trunk/src/mod/endpoints/mod_exosip/mod_exosip.c (original)
+++ freeswitch/trunk/src/mod/endpoints/mod_exosip/mod_exosip.c Fri Jul 14 14:31:23 2006
@@ -352,10 +352,9 @@
sprintf(dbuf, "%u", tech_pvt->te);
sdp_message_m_payload_add(tech_pvt->local_sdp, 0, osip_strdup(dbuf));
sdp_add_codec(tech_pvt->sdp_config, SWITCH_CODEC_TYPE_AUDIO, tech_pvt->te, "telephone-event", 8000, 0);
- sprintf(dbuf, "%u telephone-event/8000", tech_pvt->te);
+ sprintf(dbuf, "%u telephone-event/8000\na=fmtp %u 0-15", tech_pvt->te, tech_pvt->te);
sdp_message_a_attribute_add(tech_pvt->local_sdp, 0, "rtpmap", osip_strdup(dbuf));
-
if (tech_pvt->num_codecs > 0) {
int i, lastcode = -1;
@@ -1310,11 +1309,9 @@
sprintf(dbuf, "%u", tech_pvt->te);
sdp_message_m_payload_add(tech_pvt->local_sdp, 0, osip_strdup(dbuf));
sdp_add_codec(tech_pvt->sdp_config, SWITCH_CODEC_TYPE_AUDIO, tech_pvt->te, "telephone-event", 8000, 0);
- sprintf(dbuf, "%u telephone-event/8000", tech_pvt->te);
+ sprintf(dbuf, "%u telephone-event/8000\na=fmtp %u 0-15", tech_pvt->te, tech_pvt->te);
sdp_message_a_attribute_add(tech_pvt->local_sdp, 0, "rtpmap", osip_strdup(dbuf));
-
-
if (tech_pvt->num_codecs > 0) {
int i;
static const switch_codec_implementation_t *imp = NULL;
@@ -1597,7 +1594,8 @@
char *url;
char *expires = NULL;
osip_message_t *tmp = NULL;
- char sql[1024] = "";
+ char buf[1024];
+ char *sql = NULL;
time_t exptime;
switch_event_t *s_event;
@@ -1625,16 +1623,16 @@
}
- if (!find_reg_url(globals.db, je->request->from->url->username, sql, sizeof(sql))) {
- snprintf(sql, sizeof(sql), "insert into sip_registrations values ('%s','%s','%s',%ld)",
- je->request->from->url->username,
- je->request->from->url->host,
- url, exptime);
+ if (!find_reg_url(globals.db, je->request->from->url->username, buf, sizeof(buf))) {
+ sql = switch_core_db_mprintf("insert into sip_registrations values ('%s','%s','%s',%ld)",
+ je->request->from->url->username,
+ je->request->from->url->host,
+ url, exptime);
} else {
- snprintf(sql, sizeof(sql), "update sip_registrations set url='%s', expires=%ld where key = '%s'",
- url,
- exptime,
- je->request->from->url->username);
+ sql = switch_core_db_mprintf("update sip_registrations set url='%s', expires=%ld where key = '%s'",
+ url,
+ exptime,
+ je->request->from->url->username);
}
@@ -1644,9 +1642,13 @@
switch_event_add_header(s_event, SWITCH_STACK_BOTTOM, "expires", "%ld", exptime);
switch_event_fire(&s_event);
}
- switch_mutex_lock(globals.reg_mutex);
- switch_core_db_persistant_execute(globals.db, sql, 25);
- switch_mutex_unlock(globals.reg_mutex);
+ if (sql) {
+ switch_mutex_lock(globals.reg_mutex);
+ switch_core_db_persistant_execute(globals.db, sql, 25);
+ switch_core_db_free(sql);
+ sql = NULL;
+ switch_mutex_unlock(globals.reg_mutex);
+ }
eXosip_lock();
if (eXosip_message_build_answer(je->tid, 200, &tmp) < 0) {
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "build_answer failed\n");
More information about the Freeswitch-svn
mailing list