struct jrtp4c;
struct jrtp4c *jrtp4c_new(char *rx_ip, int rx_port, char *tx_ip, int tx_port, int payload, int sps, const char **err);
void jrtp4c_destroy(struct jrtp4c **jrtp4c);
- int jrtp4c_read(struct jrtp4c *jrtp4c, void *data, int datalen);
+ int jrtp4c_read(struct jrtp4c *jrtp4c, void *data, int datalen, int *payload_type);
int jrtp4c_write(struct jrtp4c *jrtp4c, void *data, int datalen, uint32_t ts);
uint32_t jrtp4c_start(struct jrtp4c *jrtp4c);
uint32_t jrtp4c_get_ssrc(struct jrtp4c *jrtp4c);
static switch_status exosip_kill_channel(switch_core_session *session, int sig);
static void activate_rtp(struct private_object *tech_pvt);
static void deactivate_rtp(struct private_object *tech_pvt);
+static void sdp_add_rfc2833(struct osip_rfc3264 *cnf);
static struct private_object *get_pvt_by_call_id(int id)
{
}
}
}
+
+ sdp_add_rfc2833(tech_pvt->sdp_config);
+
/* Setup our INVITE */
eXosip_lock();
if ((dest_uri =
struct private_object *tech_pvt = NULL;
size_t bytes = 0, samples = 0, frames = 0, ms = 0;
switch_channel *channel = NULL;
+ int payload = 0;
channel = switch_core_session_get_channel(session);
assert(channel != NULL);
while (!switch_test_flag(tech_pvt, TFLAG_BYE) && switch_test_flag(tech_pvt, TFLAG_IO)
&& tech_pvt->read_frame.datalen == 0) {
tech_pvt->read_frame.datalen =
- jrtp4c_read(tech_pvt->rtp_session, tech_pvt->read_frame.data, sizeof(tech_pvt->read_buf));
+ jrtp4c_read(tech_pvt->rtp_session, tech_pvt->read_frame.data, sizeof(tech_pvt->read_buf), &payload);
+
+
+
+ if (payload == 101) {
+ unsigned char *data;
+ unsigned int event;
+ unsigned int event_end;
+ unsigned int duration;
+ data = tech_pvt->read_frame.data;
+
+ event = ntohl(*((unsigned int *)(data)));
+ event >>= 24;
+ event_end = ntohl(*((unsigned int *)(data)));
+ event_end <<= 8;
+ event_end >>= 24;
+ duration = ntohl(*((unsigned int *)(data)));
+ duration &= 0xFFFF;
+
+ printf("DTMF %d %d %d\n", event, event_end, duration);
+ }
+
+ if (payload != tech_pvt->payload_num) {
+ printf("lets skip %d\n", payload);
+ continue;
+ }
if (tech_pvt->read_frame.datalen > 0) {
bytes = tech_pvt->read_codec.implementation->encoded_bytes_per_frame;
/* Transmit 183 Progress with SDP */
eXosip_lock();
eXosip_call_build_answer(tech_pvt->tid, 183, &progress);
+ sdp_add_rfc2833(tech_pvt->sdp_config);
sdp_message_to_str(tech_pvt->local_sdp, &buf);
osip_message_set_body(progress, buf, strlen(buf));
osip_message_set_content_type(progress, "application/sdp");
return SWITCH_STATUS_SUCCESS;
}
+static void sdp_add_rfc2833(struct osip_rfc3264 *cnf)
+{
+ sdp_media_t *med = NULL;
+ sdp_attribute_t *attr = NULL;
+
+ sdp_media_init(&med);
+ sdp_attribute_init(&attr);
+ attr->a_att_field = osip_strdup("rtpmap");
+ attr->a_att_value = osip_strdup("101 telephony-event/8000");
+ osip_list_add(med->a_attributes, attr, -1);
+
+
+ med->m_media = osip_strdup("telephony-event");
+ osip_rfc3264_add_audio_media(cnf, med, -1);
+
+}
+
static switch_status exosip_create_call(eXosip_event_t * event)
{
switch_core_session *session;
int i;
static const switch_codec_implementation *imp;
+ sdp_add_rfc2833(tech_pvt->sdp_config);
+
for (i = 0; i < num_codecs; i++) {
int x = 0;
+
for (imp = codecs[i]->implementations; imp; imp = imp->next) {
sdp_add_codec(tech_pvt->sdp_config, codecs[i]->codec_type, codecs[i]->ianacode, codecs[i]->iananame,
imp->samples_per_second, x++);