[svn-commits] rmudgett: trunk r306396 - in /trunk: ./ apps/ channels/ configs/ include/aste...

SVN commits to the Digium repositories svn-commits at lists.digium.com
Fri Feb 4 14:30:53 CST 2011


Author: rmudgett
Date: Fri Feb  4 14:30:48 2011
New Revision: 306396

URL: http://svnview.digium.com/svn/asterisk?view=rev&rev=306396
Log:
Add ISDN display ie text handling options to chan_dahdi.conf.

The display ie handling can be controlled independently in the send and
receive directions with the following options:

* Block display text data.

* Use display text in SETUP/CONNECT messages for name.

* Use display text for COLP name updates (FACILITY/NOTIFY as appropriate).

* Pass arbitrary display text during a call.  Sent in INFORMATION
messages.  Received from any message that the display text was not used as
a name.

If the display options are not set then the options default to legacy
behavior.

The arbitrary display text is exchanged between bridged channels using the
AST_FRAME_TEXT frame type.

To send display text from the dialplan use the SendText() application when
the arbitrary display text option is enabled.

JIRA SWP-2688
JIRA ABE-2693

Modified:
    trunk/CHANGES
    trunk/apps/app_dial.c
    trunk/channels/chan_dahdi.c
    trunk/channels/sig_pri.c
    trunk/channels/sig_pri.h
    trunk/configs/chan_dahdi.conf.sample
    trunk/configure
    trunk/configure.ac
    trunk/include/asterisk/autoconfig.h.in

Modified: trunk/CHANGES
URL: http://svnview.digium.com/svn/asterisk/trunk/CHANGES?view=diff&rev=306396&r1=306395&r2=306396
==============================================================================
--- trunk/CHANGES (original)
+++ trunk/CHANGES Fri Feb  4 14:30:48 2011
@@ -49,6 +49,9 @@
 --------------------------
  * Added moh_signaling option to specify what to do when the channel's bridged
    peer puts the ISDN channel on hold.
+ * Added display_send and display_receive options to control how the display ie
+   is handled.  To send display text from the dialplan use the SendText()
+   application when the option is enabled.
 
 ------------------------------------------------------------------------------
 --- Functionality changes from Asterisk 1.6.2 to Asterisk 1.8 ----------------

Modified: trunk/apps/app_dial.c
URL: http://svnview.digium.com/svn/asterisk/trunk/apps/app_dial.c?view=diff&rev=306396&r1=306395&r2=306396
==============================================================================
--- trunk/apps/app_dial.c (original)
+++ trunk/apps/app_dial.c Fri Feb  4 14:30:48 2011
@@ -1402,30 +1402,50 @@
 				}
 			}
 
-			/* Forward HTML stuff */
-			if (single && (f->frametype == AST_FRAME_HTML) && !ast_test_flag64(outgoing, DIAL_NOFORWARDHTML))
-				if (ast_channel_sendhtml(outgoing->chan, f->subclass.integer, f->data.ptr, f->datalen) == -1)
-					ast_log(LOG_WARNING, "Unable to send URL\n");
-
-			if (single && ((f->frametype == AST_FRAME_VOICE) || (f->frametype == AST_FRAME_DTMF_BEGIN) || (f->frametype == AST_FRAME_DTMF_END)))  {
-				if (ast_write(outgoing->chan, f))
-					ast_log(LOG_WARNING, "Unable to forward voice or dtmf\n");
-			}
-			if (single && (f->frametype == AST_FRAME_CONTROL)) { 
-				if ((f->subclass.integer == AST_CONTROL_HOLD) ||
-				    (f->subclass.integer == AST_CONTROL_UNHOLD) ||
-				    (f->subclass.integer == AST_CONTROL_VIDUPDATE) ||
-				    (f->subclass.integer == AST_CONTROL_SRCUPDATE)) {
-					ast_verb(3, "%s requested special control %d, passing it to %s\n", in->name, f->subclass.integer, outgoing->chan->name);
-					ast_indicate_data(outgoing->chan, f->subclass.integer, f->data.ptr, f->datalen);
-				} else if (f->subclass.integer == AST_CONTROL_CONNECTED_LINE) {
-					if (ast_channel_connected_line_macro(in, outgoing->chan, f, 0, 1)) {
+			if (single) {
+				switch (f->frametype) {
+				case AST_FRAME_HTML:
+					/* Forward HTML stuff */
+					if (!ast_test_flag64(outgoing, DIAL_NOFORWARDHTML)
+						&& ast_channel_sendhtml(outgoing->chan, f->subclass.integer, f->data.ptr, f->datalen) == -1) {
+						ast_log(LOG_WARNING, "Unable to send URL\n");
+					}
+					break;
+				case AST_FRAME_VOICE:
+				case AST_FRAME_IMAGE:
+				case AST_FRAME_TEXT:
+				case AST_FRAME_DTMF_BEGIN:
+				case AST_FRAME_DTMF_END:
+					if (ast_write(outgoing->chan, f)) {
+						ast_log(LOG_WARNING, "Unable to forward frametype: %d\n",
+							f->frametype);
+					}
+					break;
+				case AST_FRAME_CONTROL:
+					switch (f->subclass.integer) {
+					case AST_CONTROL_HOLD:
+					case AST_CONTROL_UNHOLD:
+					case AST_CONTROL_VIDUPDATE:
+					case AST_CONTROL_SRCUPDATE:
+						ast_verb(3, "%s requested special control %d, passing it to %s\n", in->name, f->subclass.integer, outgoing->chan->name);
 						ast_indicate_data(outgoing->chan, f->subclass.integer, f->data.ptr, f->datalen);
+						break;
+					case AST_CONTROL_CONNECTED_LINE:
+						if (ast_channel_connected_line_macro(in, outgoing->chan, f, 0, 1)) {
+							ast_indicate_data(outgoing->chan, f->subclass.integer, f->data.ptr, f->datalen);
+						}
+						break;
+					case AST_CONTROL_REDIRECTING:
+						if (ast_channel_redirecting_macro(in, outgoing->chan, f, 0, 1)) {
+							ast_indicate_data(outgoing->chan, f->subclass.integer, f->data.ptr, f->datalen);
+						}
+						break;
+					default:
+						break;
 					}
-				} else if (f->subclass.integer == AST_CONTROL_REDIRECTING) {
-					if (ast_channel_redirecting_macro(in, outgoing->chan, f, 0, 1)) {
-						ast_indicate_data(outgoing->chan, f->subclass.integer, f->data.ptr, f->datalen);
-					}
+					break;
+				default:
+					break;
 				}
 			}
 			ast_frfree(f);

Modified: trunk/channels/chan_dahdi.c
URL: http://svnview.digium.com/svn/asterisk/trunk/channels/chan_dahdi.c?view=diff&rev=306396&r1=306395&r2=306396
==============================================================================
--- trunk/channels/chan_dahdi.c (original)
+++ trunk/channels/chan_dahdi.c Fri Feb  4 14:30:48 2011
@@ -7334,13 +7334,13 @@
 			continue;
 		}
 		f = ast_read(who);
-		if (!f || (f->frametype == AST_FRAME_CONTROL)) {
+		switch (f ? f->frametype : AST_FRAME_CONTROL) {
+		case AST_FRAME_CONTROL:
 			*fo = f;
 			*rc = who;
 			res = AST_BRIDGE_COMPLETE;
 			goto return_from_bridge;
-		}
-		if (f->frametype == AST_FRAME_DTMF) {
+		case AST_FRAME_DTMF_END:
 			if ((who == c0) && p0->pulsedial) {
 				ast_write(c1, f);
 			} else if ((who == c1) && p1->pulsedial) {
@@ -7351,6 +7351,20 @@
 				res = AST_BRIDGE_COMPLETE;
 				goto return_from_bridge;
 			}
+			break;
+		case AST_FRAME_TEXT:
+			if (who == c0) {
+				ast_write(c1, f);
+			} else {
+				ast_write(c0, f);
+			}
+			break;
+		case AST_FRAME_NULL:
+			break;
+		default:
+			ast_debug(1, "Chan '%s' is discarding frame of frametype:%d\n",
+				who->name, f->frametype);
+			break;
 		}
 		ast_frfree(f);
 
@@ -12333,6 +12347,10 @@
 						ast_copy_string(pris[span].pri.unknownprefix, conf->pri.pri.unknownprefix, sizeof(pris[span].pri.unknownprefix));
 						pris[span].pri.moh_signaling = conf->pri.pri.moh_signaling;
 						pris[span].pri.resetinterval = conf->pri.pri.resetinterval;
+#if defined(HAVE_PRI_DISPLAY_TEXT)
+						pris[span].pri.display_flags_send = conf->pri.pri.display_flags_send;
+						pris[span].pri.display_flags_receive = conf->pri.pri.display_flags_receive;
+#endif	/* defined(HAVE_PRI_DISPLAY_TEXT) */
 
 						for (x = 0; x < PRI_MAX_TIMERS; x++) {
 							pris[span].pri.pritimers[x] = conf->pri.pri.pritimers[x];
@@ -16461,6 +16479,53 @@
 		confp->chan.echocancel.head.param_count++;
 	}
 }
+
+#if defined(HAVE_PRI)
+#if defined(HAVE_PRI_DISPLAY_TEXT)
+/*!
+ * \internal
+ * \brief Determine the configured display text options.
+ * \since 1.10
+ *
+ * \param value Configuration value string.
+ *
+ * \return Configured display text option flags.
+ */
+static unsigned long dahdi_display_text_option(const char *value)
+{
+	char *val_str;
+	char *opt_str;
+	unsigned long options;
+
+	options = 0;
+	val_str = ast_strdupa(value);
+
+	for (;;) {
+		opt_str = strsep(&val_str, ",");
+		if (!opt_str) {
+			break;
+		}
+		opt_str = ast_strip(opt_str);
+		if (!*opt_str) {
+			continue;
+		}
+
+		if (!strcasecmp(opt_str, "block")) {
+			options |= PRI_DISPLAY_OPTION_BLOCK;
+		} else if (!strcasecmp(opt_str, "name_initial")) {
+			options |= PRI_DISPLAY_OPTION_NAME_INITIAL;
+		} else if (!strcasecmp(opt_str, "name_update")) {
+			options |= PRI_DISPLAY_OPTION_NAME_UPDATE;
+		} else if (!strcasecmp(opt_str, "name")) {
+			options |= (PRI_DISPLAY_OPTION_NAME_INITIAL | PRI_DISPLAY_OPTION_NAME_UPDATE);
+		} else if (!strcasecmp(opt_str, "text")) {
+			options |= PRI_DISPLAY_OPTION_TEXT;
+		}
+	}
+	return options;
+}
+#endif	/* defined(HAVE_PRI_DISPLAY_TEXT) */
+#endif	/* defined(HAVE_PRI) */
 
 /*! process_dahdi() - ignore keyword 'channel' and similar */
 #define PROC_DAHDI_OPT_NOCHAN  (1 << 0)
@@ -17234,6 +17299,12 @@
 #endif	/* defined(HAVE_PRI_MWI) */
 			} else if (!strcasecmp(v->name, "append_msn_to_cid_tag")) {
 				confp->pri.pri.append_msn_to_user_tag = ast_true(v->value);
+#if defined(HAVE_PRI_DISPLAY_TEXT)
+			} else if (!strcasecmp(v->name, "display_send")) {
+				confp->pri.pri.display_flags_send = dahdi_display_text_option(v->value);
+			} else if (!strcasecmp(v->name, "display_receive")) {
+				confp->pri.pri.display_flags_receive = dahdi_display_text_option(v->value);
+#endif	/* defined(HAVE_PRI_DISPLAY_TEXT) */
 #endif /* HAVE_PRI */
 #if defined(HAVE_SS7)
 			} else if (!strcasecmp(v->name, "ss7type")) {
@@ -18150,13 +18221,26 @@
 	float scont = 0.0;
 	int idx;
 
+	if (!text[0]) {
+		return(0); /* if nothing to send, don't */
+	}
 	idx = dahdi_get_index(c, p, 0);
 	if (idx < 0) {
 		ast_log(LOG_WARNING, "Huh?  I don't exist?\n");
 		return -1;
 	}
-	if (!text[0]) return(0); /* if nothing to send, don't */
-	if ((!p->tdd) && (!p->mate)) return(0);  /* if not in TDD mode, just return */
+	if ((!p->tdd) && (!p->mate)) {
+#if defined(HAVE_PRI)
+#if defined(HAVE_PRI_DISPLAY_TEXT)
+		ast_mutex_lock(&p->lock);
+		if (dahdi_sig_pri_lib_handles(p->sig)) {
+			sig_pri_sendtext(p->sig_pvt, text);
+		}
+		ast_mutex_unlock(&p->lock);
+#endif	/* defined(HAVE_PRI_DISPLAY_TEXT) */
+#endif	/* defined(HAVE_PRI) */
+		return(0);  /* if not in TDD mode, just return */
+	}
 	if (p->mate)
 		buf = ast_malloc(((strlen(text) + 1) * ASCII_BYTES_PER_CHAR) + END_SILENCE_LEN + HEADER_LEN);
 	else

Modified: trunk/channels/sig_pri.c
URL: http://svnview.digium.com/svn/asterisk/trunk/channels/sig_pri.c?view=diff&rev=306396&r1=306395&r2=306396
==============================================================================
--- trunk/channels/sig_pri.c (original)
+++ trunk/channels/sig_pri.c Fri Feb  4 14:30:48 2011
@@ -4084,6 +4084,31 @@
 			/* Ignore for now. */
 			break;
 #endif	/* defined(HAVE_PRI_MCID) */
+#if defined(HAVE_PRI_DISPLAY_TEXT)
+		case PRI_SUBCMD_DISPLAY_TEXT:
+			if (event_id != PRI_EVENT_RING) {
+				/*
+				 * This display text was not from a SETUP message.  We can do
+				 * something with this display text string.
+				 */
+				sig_pri_lock_owner(pri, chanpos);
+				owner = pri->pvts[chanpos]->owner;
+				if (owner) {
+					struct ast_frame f;
+
+					/* Pass the display text to the peer channel. */
+					memset(&f, 0, sizeof(f));
+					f.frametype = AST_FRAME_TEXT;
+					f.subclass.integer = 0;
+					f.offset = 0;
+					f.data.ptr = &subcmd->u.display.text;
+					f.datalen = subcmd->u.display.length + 1;
+					ast_queue_frame(owner, &f);
+					ast_channel_unlock(owner);
+				}
+			}
+			break;
+#endif	/* defined(HAVE_PRI_DISPLAY_TEXT) */
 		default:
 			ast_debug(2,
 				"Unknown call subcommand(%d) in %s event on channel %d/%d on span %d.\n",
@@ -8171,6 +8196,10 @@
 #if defined(HAVE_PRI_MCID)
 	pri_mcid_enable(pri->pri, 1);
 #endif	/* defined(HAVE_PRI_MCID) */
+#if defined(HAVE_PRI_DISPLAY_TEXT)
+	pri_display_options_send(pri->pri, pri->display_flags_send);
+	pri_display_options_receive(pri->pri, pri->display_flags_receive);
+#endif	/* defined(HAVE_PRI_DISPLAY_TEXT) */
 
 	pri->resetpos = -1;
 	if (ast_pthread_create_background(&pri->master, NULL, pri_dchannel, pri)) {
@@ -8383,6 +8412,31 @@
 	}
 }
 
+#if defined(HAVE_PRI_DISPLAY_TEXT)
+/*!
+ * \brief Send display text.
+ * \since 1.10
+ *
+ * \param p Channel to send text over
+ * \param text Text to send.
+ *
+ * \return Nothing
+ */
+void sig_pri_sendtext(struct sig_pri_chan *p, const char *text)
+{
+	struct pri_subcmd_display_txt display;
+
+	if (p->pri && p->pri->pri) {
+		ast_copy_string(display.text, text, sizeof(display.text));
+		display.length = strlen(display.text);
+		display.char_set = 0;/* unknown(0) */
+		pri_grab(p, p->pri);
+		pri_display_text(p->pri->pri, p->call, &display);
+		pri_rel(p->pri);
+	}
+}
+#endif	/* defined(HAVE_PRI_DISPLAY_TEXT) */
+
 #if defined(HAVE_PRI_CCSS)
 /*!
  * \brief PRI CC agent initialization.

Modified: trunk/channels/sig_pri.h
URL: http://svnview.digium.com/svn/asterisk/trunk/channels/sig_pri.h?view=diff&rev=306396&r1=306395&r2=306396
==============================================================================
--- trunk/channels/sig_pri.h (original)
+++ trunk/channels/sig_pri.h Fri Feb  4 14:30:48 2011
@@ -412,6 +412,10 @@
 	char unknownprefix[20];					/*!< for unknown dialplans */
 	enum sig_pri_moh_signaling moh_signaling;
 	long resetinterval;						/*!< Interval (in seconds) for resetting unused channels */
+#if defined(HAVE_PRI_DISPLAY_TEXT)
+	unsigned long display_flags_send;		/*!< PRI_DISPLAY_OPTION_xxx flags for display text sending */
+	unsigned long display_flags_receive;	/*!< PRI_DISPLAY_OPTION_xxx flags for display text receiving */
+#endif	/* defined(HAVE_PRI_DISPLAY_TEXT) */
 #if defined(HAVE_PRI_MWI)
 	/*! \brief Active MWI mailboxes */
 	struct sig_pri_mbox mbox[SIG_PRI_MAX_MWI_MAILBOXES];
@@ -576,6 +580,9 @@
 #endif	/* defined(HAVE_PRI_SERVICE_MESSAGES) */
 
 void sig_pri_fixup(struct ast_channel *oldchan, struct ast_channel *newchan, struct sig_pri_chan *pchan);
+#if defined(HAVE_PRI_DISPLAY_TEXT)
+void sig_pri_sendtext(struct sig_pri_chan *pchan, const char *text);
+#endif	/* defined(HAVE_PRI_DISPLAY_TEXT) */
 
 int sig_pri_cc_agent_init(struct ast_cc_agent *agent, struct sig_pri_chan *pvt_chan);
 int sig_pri_cc_agent_start_offer_timer(struct ast_cc_agent *agent);

Modified: trunk/configs/chan_dahdi.conf.sample
URL: http://svnview.digium.com/svn/asterisk/trunk/configs/chan_dahdi.conf.sample?view=diff&rev=306396&r1=306395&r2=306396
==============================================================================
--- trunk/configs/chan_dahdi.conf.sample (original)
+++ trunk/configs/chan_dahdi.conf.sample Fri Feb  4 14:30:48 2011
@@ -205,7 +205,32 @@
 ; yes or both: both directions
 ;
 ;overlapdial=yes
-;
+
+; Send/receive ISDN display IE options.  The display options are a comma separated
+; list of the following options:
+;
+; block:        Do not pass display text data.
+;               Q.SIG: Default for send/receive.
+;               ETSI CPE: Default for send.
+; name_initial: Use display text in SETUP/CONNECT messages as the party name.
+;               Default for all other modes.
+; name_update:  Use display text in other messages (NOTIFY/FACILITY) for COLP name
+;               update.
+; name:         Combined name_initial and name_update options.
+; text:         Pass any unused display text data as an arbitrary display message
+;               during a call.  Sent text goes out in an INFORMATION message.
+;
+; * Default is an empty string for legacy behavior.
+; * The name options are not recommended for Q.SIG since Q.SIG already
+;   supports names.
+; * The send block is the only recommended setting for CPE mode since Q.931 uses
+;   the display IE only in the network to user direction.
+;
+; display_send and display_receive cannot be changed on reload.
+;
+;display_send=
+;display_receive=
+
 ; Allow inband audio (progress) when a call is DISCONNECTed by the far end of a PRI
 ;
 ;inbanddisconnect=yes

Modified: trunk/configure.ac
URL: http://svnview.digium.com/svn/asterisk/trunk/configure.ac?view=diff&rev=306396&r1=306395&r2=306396
==============================================================================
--- trunk/configure.ac (original)
+++ trunk/configure.ac Fri Feb  4 14:30:48 2011
@@ -414,6 +414,7 @@
 AST_EXT_LIB_SETUP([POPT], [popt], [popt])
 AST_EXT_LIB_SETUP([PORTAUDIO], [PortAudio], [portaudio])
 AST_EXT_LIB_SETUP([PRI], [ISDN PRI], [pri])
+AST_EXT_LIB_SETUP_DEPENDENT([PRI_DISPLAY_TEXT], [ISDN PRI user display text IE contents during call], [PRI], [pri])
 AST_EXT_LIB_SETUP_DEPENDENT([PRI_MWI], [ISDN PRI Message Waiting Indication], [PRI], [pri])
 AST_EXT_LIB_SETUP_DEPENDENT([PRI_MCID], [ISDN PRI Malicious Call ID], [PRI], [pri])
 AST_EXT_LIB_SETUP_DEPENDENT([PRI_CALL_WAITING], [ISDN PRI call waiting supplementary service], [PRI], [pri])
@@ -1811,6 +1812,7 @@
 AST_EXT_LIB_CHECK([PORTAUDIO], [portaudio], [Pa_GetDeviceCount], [portaudio.h])
 
 AST_EXT_LIB_CHECK([PRI], [pri], [pri_connected_line_update], [libpri.h])
+AST_EXT_LIB_CHECK([PRI_DISPLAY_TEXT], [pri], [pri_display_text], [libpri.h])
 AST_EXT_LIB_CHECK([PRI_MWI], [pri], [pri_mwi_indicate], [libpri.h])
 AST_EXT_LIB_CHECK([PRI_MCID], [pri], [pri_mcid_enable], [libpri.h])
 AST_EXT_LIB_CHECK([PRI_CALL_WAITING], [pri], [pri_connect_ack_enable], [libpri.h])

Modified: trunk/include/asterisk/autoconfig.h.in
URL: http://svnview.digium.com/svn/asterisk/trunk/include/asterisk/autoconfig.h.in?view=diff&rev=306396&r1=306395&r2=306396
==============================================================================
--- trunk/include/asterisk/autoconfig.h.in (original)
+++ trunk/include/asterisk/autoconfig.h.in Fri Feb  4 14:30:48 2011
@@ -576,6 +576,10 @@
    library. */
 #undef HAVE_PRI_CCSS
 
+/* Define to 1 if you have the ISDN PRI user display text IE contents during
+   call library. */
+#undef HAVE_PRI_DISPLAY_TEXT
+
 /* Define to 1 if you have the ISDN PRI hangup fix library. */
 #undef HAVE_PRI_HANGUP_FIX
 
@@ -819,16 +823,16 @@
 /* Define to 1 if you have the `strtoq' function. */
 #undef HAVE_STRTOQ
 
-/* Define to 1 if `ifr_ifru.ifru_hwaddr' is a member of `struct ifreq'. */
+/* Define to 1 if `ifr_ifru.ifru_hwaddr' is member of `struct ifreq'. */
 #undef HAVE_STRUCT_IFREQ_IFR_IFRU_IFRU_HWADDR
 
-/* Define to 1 if `st_blksize' is a member of `struct stat'. */
+/* Define to 1 if `st_blksize' is member of `struct stat'. */
 #undef HAVE_STRUCT_STAT_ST_BLKSIZE
 
-/* Define to 1 if `cr_uid' is a member of `struct ucred'. */
+/* Define to 1 if `cr_uid' is member of `struct ucred'. */
 #undef HAVE_STRUCT_UCRED_CR_UID
 
-/* Define to 1 if `uid' is a member of `struct ucred'. */
+/* Define to 1 if `uid' is member of `struct ucred'. */
 #undef HAVE_STRUCT_UCRED_UID
 
 /* Define to 1 if you have the mISDN Supplemental Services library. */
@@ -1105,9 +1109,6 @@
 
 /* Define to the one symbol short name of this package. */
 #undef PACKAGE_TARNAME
-
-/* Define to the home page for this package. */
-#undef PACKAGE_URL
 
 /* Define to the version of this package. */
 #undef PACKAGE_VERSION




More information about the svn-commits mailing list