Author: anthm Date: Fri Jul 14 15:20:54 2006 New Revision: 1882 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 15:20:54 2006 @@ -352,8 +352,10 @@ 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\na=fmtp %u 0-15", tech_pvt->te, tech_pvt->te); + sprintf(dbuf, "%u telephone-event/8000", tech_pvt->te); sdp_message_a_attribute_add(tech_pvt->local_sdp, 0, "rtpmap", osip_strdup(dbuf)); + sprintf(dbuf, "%u 0-15", tech_pvt->te); + sdp_message_a_attribute_add(tech_pvt->local_sdp, 0, "fmtp", osip_strdup(dbuf)); if (tech_pvt->num_codecs > 0) { int i, lastcode = -1; @@ -1306,11 +1308,6 @@ sdp_message_init(&tech_pvt->local_sdp); - 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\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; @@ -1318,8 +1315,12 @@ for (i = 0; i < tech_pvt->num_codecs; i++) { for (imp = tech_pvt->codecs[i]; imp; imp = imp->next) { - sdp_add_codec(tech_pvt->sdp_config, tech_pvt->codecs[i]->codec_type, imp->ianacode, imp->iananame, - imp->samples_per_second, 0); + sdp_add_codec(tech_pvt->sdp_config, + tech_pvt->codecs[i]->codec_type, + imp->ianacode, + imp->iananame, + imp->samples_per_second, + 0); } } @@ -1335,6 +1336,7 @@ sdp_message_to_str(remote_sdp, &remote_sdp_str); switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "REMOTE SDP:\n%s", remote_sdp_str); + mline = 0; while (0 == osip_rfc3264_match(tech_pvt->sdp_config, remote_sdp, audio_tab, video_tab, t38_tab, app_tab, mline)) { if (audio_tab[0] == NULL && video_tab[0] == NULL && t38_tab[0] == NULL && app_tab[0] == NULL) { @@ -1355,6 +1357,18 @@ done: free(remote_sdp_str); + + + 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); + sdp_message_a_attribute_add(tech_pvt->local_sdp, 0, "rtpmap", osip_strdup(dbuf)); + sprintf(dbuf, "%u 0-15", tech_pvt->te); + sdp_message_a_attribute_add(tech_pvt->local_sdp, 0, "fmtp", osip_strdup(dbuf)); + + sdp_message_o_origin_set(tech_pvt->local_sdp, "FreeSWITCH", "0", "0", "IN", "IP4", ip); sdp_message_s_name_set(tech_pvt->local_sdp, "SIP Call");