Index: /pjproject/trunk/pjmedia/include/pjmedia/endpoint.h
===================================================================
--- /pjproject/trunk/pjmedia/include/pjmedia/endpoint.h	(revision 3359)
+++ /pjproject/trunk/pjmedia/include/pjmedia/endpoint.h	(revision 3360)
@@ -43,4 +43,19 @@
 
 PJ_BEGIN_DECL
+
+/**
+ * This enumeration describes various flags that can be set or retrieved in
+ * the media endpoint, by using pjmedia_endpt_set_flag() and
+ * pjmedia_endpt_get_flag() respectively.
+ */
+typedef enum pjmedia_endpt_flag
+{
+    /**
+     * This flag controls whether telephony-event should be offered in SDP.
+     * Value is boolean.
+     */
+    PJMEDIA_ENDPT_HAS_TELEPHONE_EVENT_FLAG
+
+} pjmedia_endpt_flag;
 
 
@@ -74,5 +89,29 @@
 PJ_DECL(pj_status_t) pjmedia_endpt_destroy(pjmedia_endpt *endpt);
 
-
+/**
+ * Change the value of a flag.
+ *
+ * @param endpt		Media endpoint.
+ * @param flag		The flag.
+ * @param value		Pointer to the value to be set.
+ *
+ * @reurn		PJ_SUCCESS on success.
+ */
+PJ_DECL(pj_status_t) pjmedia_endpt_set_flag(pjmedia_endpt *endpt,
+					    pjmedia_endpt_flag flag,
+					    const void *value);
+
+/**
+ *  Retrieve the value of a flag.
+ *
+ *  @param endpt	Media endpoint.
+ *  @param flag		The flag.
+ *  @param value	Pointer to store the result.
+ *
+ *  @return		PJ_SUCCESS on success.
+ */
+PJ_DECL(pj_status_t) pjmedia_endpt_get_flag(pjmedia_endpt *endpt,
+					    pjmedia_endpt_flag flag,
+					    void *value);
 
 /**
Index: /pjproject/trunk/pjmedia/src/pjmedia/endpoint.c
===================================================================
--- /pjproject/trunk/pjmedia/src/pjmedia/endpoint.c	(revision 3359)
+++ /pjproject/trunk/pjmedia/src/pjmedia/endpoint.c	(revision 3360)
@@ -88,4 +88,7 @@
     /** To signal polling thread to quit. */
     pj_bool_t		  quit_flag;
+
+    /** Is telephone-event enable */
+    pj_bool_t		  has_telephone_event;
 };
 
@@ -121,4 +124,5 @@
     endpt->ioqueue = ioqueue;
     endpt->thread_cnt = worker_cnt;
+    endpt->has_telephone_event = PJ_TRUE;
 
     /* Sound */
@@ -222,4 +226,37 @@
 }
 
+PJ_DEF(pj_status_t) pjmedia_endpt_set_flag( pjmedia_endpt *endpt,
+					    pjmedia_endpt_flag flag,
+					    const void *value)
+{
+    PJ_ASSERT_RETURN(endpt, PJ_EINVAL);
+
+    switch (flag) {
+    case PJMEDIA_ENDPT_HAS_TELEPHONE_EVENT_FLAG:
+	endpt->has_telephone_event = *(pj_bool_t*)value;
+	break;
+    default:
+	return PJ_EINVAL;
+    }
+
+    return PJ_SUCCESS;
+}
+
+PJ_DEF(pj_status_t) pjmedia_endpt_get_flag( pjmedia_endpt *endpt,
+					    pjmedia_endpt_flag flag,
+					    void *value)
+{
+    PJ_ASSERT_RETURN(endpt, PJ_EINVAL);
+
+    switch (flag) {
+    case PJMEDIA_ENDPT_HAS_TELEPHONE_EVENT_FLAG:
+	*(pj_bool_t*)value = endpt->has_telephone_event;
+	break;
+    default:
+	return PJ_EINVAL;
+    }
+
+    return PJ_SUCCESS;
+}
 
 /**
@@ -490,23 +527,24 @@
 #if defined(PJMEDIA_RTP_PT_TELEPHONE_EVENTS) && \
     PJMEDIA_RTP_PT_TELEPHONE_EVENTS != 0
-
     /*
      * Add support telephony event
      */
-    m->desc.fmt[m->desc.fmt_count++] = 
-	pj_str(PJMEDIA_RTP_PT_TELEPHONE_EVENTS_STR);
-
-    /* Add rtpmap. */
-    attr = PJ_POOL_ZALLOC_T(pool, pjmedia_sdp_attr);
-    attr->name = pj_str("rtpmap");
-    attr->value = pj_str(PJMEDIA_RTP_PT_TELEPHONE_EVENTS_STR 
-			 " telephone-event/8000");
-    m->attr[m->attr_count++] = attr;
-
-    /* Add fmtp */
-    attr = PJ_POOL_ZALLOC_T(pool, pjmedia_sdp_attr);
-    attr->name = pj_str("fmtp");
-    attr->value = pj_str(PJMEDIA_RTP_PT_TELEPHONE_EVENTS_STR " 0-15");
-    m->attr[m->attr_count++] = attr;
+    if (endpt->has_telephone_event) {
+	m->desc.fmt[m->desc.fmt_count++] =
+	    pj_str(PJMEDIA_RTP_PT_TELEPHONE_EVENTS_STR);
+
+	/* Add rtpmap. */
+	attr = PJ_POOL_ZALLOC_T(pool, pjmedia_sdp_attr);
+	attr->name = pj_str("rtpmap");
+	attr->value = pj_str(PJMEDIA_RTP_PT_TELEPHONE_EVENTS_STR
+			     " telephone-event/8000");
+	m->attr[m->attr_count++] = attr;
+
+	/* Add fmtp */
+	attr = PJ_POOL_ZALLOC_T(pool, pjmedia_sdp_attr);
+	attr->name = pj_str("fmtp");
+	attr->value = pj_str(PJMEDIA_RTP_PT_TELEPHONE_EVENTS_STR " 0-15");
+	m->attr[m->attr_count++] = attr;
+    }
 #endif
 
