[asterisk-commits] dvossel: trunk r174046 - in /trunk: ./ channels/ configs/

SVN commits to the Asterisk project asterisk-commits at lists.digium.com
Fri Feb 6 14:12:33 CST 2009


Author: dvossel
Date: Fri Feb  6 14:12:33 2009
New Revision: 174046

URL: http://svn.digium.com/svn-view/asterisk?view=rev&rev=174046
Log:
Adds immediate yes/no option to iax.conf

This is very similar to the DAHDI immediate=yes option.  When the phone is picked up, instead of giving a dialtone it connects directly to the "s" extension.  Changes where implemented in chan_iax2.c to directly connect to the "s" extension in the appropriate context when this option is enabled.  Examples explaining its use are added to iax2.conf.sample.  CHANGES has been updated as well. 

(closes issue #14266)
Reported by: jcovert
Patches:
      chan_iax2.c.patch-trunk uploaded by jcovert (license 551)
      iax.conf.sample.patch uploaded by jcovert (license 551)
Tested by: jcovert, dvossel
Review: http://reviewboard.digium.com/r/143/

Modified:
    trunk/CHANGES
    trunk/channels/chan_iax2.c
    trunk/configs/iax.conf.sample

Modified: trunk/CHANGES
URL: http://svn.digium.com/svn-view/asterisk/trunk/CHANGES?view=diff&rev=174046&r1=174045&r2=174046
==============================================================================
--- trunk/CHANGES (original)
+++ trunk/CHANGES Fri Feb  6 14:12:33 2009
@@ -545,6 +545,7 @@
   * Added the srvlookup option to iax.conf
   * Added support for OSP.  The token is set and retrieved through the CHANNEL()
      dialplan function.
+  * Added immediate option to iax.conf
 
 XMPP Google Talk/Jingle changes
 -------------------------------

Modified: trunk/channels/chan_iax2.c
URL: http://svn.digium.com/svn-view/asterisk/trunk/channels/chan_iax2.c?view=diff&rev=174046&r1=174045&r2=174046
==============================================================================
--- trunk/channels/chan_iax2.c (original)
+++ trunk/channels/chan_iax2.c Fri Feb  6 14:12:33 2009
@@ -369,13 +369,14 @@
 	IAX_FORCEJITTERBUF =	(1 << 20),	/*!< Force jitterbuffer, even when bridged to a channel that can take jitter */ 
 	IAX_RTIGNOREREGEXPIRE =	(1 << 21),	/*!< When using realtime, ignore registration expiration */
 	IAX_TRUNKTIMESTAMPS =	(1 << 22),	/*!< Send trunk timestamps */
-	IAX_TRANSFERMEDIA = 	(1 << 23),      /*!< When doing IAX2 transfers, transfer media only */
+	IAX_TRANSFERMEDIA =     (1 << 23),      /*!< When doing IAX2 transfers, transfer media only */
 	IAX_MAXAUTHREQ =        (1 << 24),      /*!< Maximum outstanding AUTHREQ restriction is in place */
 	IAX_DELAYPBXSTART =	(1 << 25),	/*!< Don't start a PBX on the channel until the peer sends us a
 						     response, so that we've achieved a three-way handshake with
 						     them before sending voice or anything else*/
-	IAX_ALLOWFWDOWNLOAD = (1 << 26),	/*!< Allow the FWDOWNL command? */
-	IAX_NOKEYROTATE = (1 << 27), /*!< Disable key rotation with encryption */
+	IAX_ALLOWFWDOWNLOAD =   (1 << 26),	/*!< Allow the FWDOWNL command? */
+	IAX_NOKEYROTATE =       (1 << 27),	/*!< Disable key rotation with encryption */
+	IAX_IMMEDIATE =		(1 << 28),      /*!< Allow immediate off-hook to extension s */
 };
 
 static int global_rtautoclear = 120;
@@ -6221,6 +6222,7 @@
 			ast_set_flag(iaxs[callno], IAX_MAXAUTHREQ);
 		iaxs[callno]->prefs = user->prefs;
 		ast_copy_flags(iaxs[callno], user, IAX_CODEC_USER_FIRST);
+		ast_copy_flags(iaxs[callno], user, IAX_IMMEDIATE);
 		ast_copy_flags(iaxs[callno], user, IAX_CODEC_NOPREFS);
 		ast_copy_flags(iaxs[callno], user, IAX_CODEC_NOCAP);
 		ast_copy_flags(iaxs[callno], user, IAX_NOKEYROTATE);
@@ -9465,11 +9467,15 @@
 							ast_set_flag(&iaxs[fr->callno]->state, IAX_STATE_TBD);
 							/* If this is a TBD call, we're ready but now what...  */
 							ast_verb(3, "Accepted AUTHENTICATED TBD call from %s\n", ast_inet_ntoa(sin.sin_addr));
+							if (ast_test_flag(iaxs[fr->callno], IAX_IMMEDIATE)) {
+								goto immediatedial;
+							}
 						}
 					}
 				}
 				break;
 			case IAX_COMMAND_DIAL:
+immediatedial:
 				if (ast_test_flag(&iaxs[fr->callno]->state, IAX_STATE_TBD)) {
 					ast_clear_flag(&iaxs[fr->callno]->state, IAX_STATE_TBD);
 					ast_string_field_set(iaxs[fr->callno], exten, ies.called_number ? ies.called_number : "s");
@@ -10984,6 +10990,8 @@
 					ast_set_flag(user, IAX_CODEC_NOCAP);
 					ast_set_flag(user, IAX_CODEC_NOPREFS);
 				}
+			} else if (!strcasecmp(v->name, "immediate")) {
+				ast_set2_flag(user, ast_true(v->value), IAX_IMMEDIATE);
 			} else if (!strcasecmp(v->name, "jitterbuffer")) {
 				ast_set2_flag(user, ast_true(v->value), IAX_USEJITTERBUF);
 			} else if (!strcasecmp(v->name, "forcejitterbuffer")) {

Modified: trunk/configs/iax.conf.sample
URL: http://svn.digium.com/svn-view/asterisk/trunk/configs/iax.conf.sample?view=diff&rev=174046&r1=174045&r2=174046
==============================================================================
--- trunk/configs/iax.conf.sample (original)
+++ trunk/configs/iax.conf.sample Fri Feb  6 14:12:33 2009
@@ -469,3 +469,15 @@
 ;context=default
 ;permit=0.0.0.0/0.0.0.0
 
+;
+; With immediate=yes, an IAX phone or a phone on an IAXy acts as a hot-line
+; which goes immediately to the s extension when picked up.  Useful for
+; elevator phones, manual service, or other similar applications.
+;
+;[manual]
+;type=friend
+;host=dynamic
+;immediate=yes  ; go immediately to s extension when picked up
+;secret=moofoo	; when immediate=yes is specified, secret is required
+;context=number-please ; we start at the s extension in this context
+;




More information about the asterisk-commits mailing list