[asterisk-commits] trunk r37508 - in /trunk: channels/ channels/misdn/ configs/

asterisk-commits at lists.digium.com asterisk-commits at lists.digium.com
Thu Jul 13 07:13:24 MST 2006


Author: crichter
Date: Thu Jul 13 09:13:24 2006
New Revision: 37508

URL: http://svn.digium.com/view/asterisk?rev=37508&view=rev
Log:
added even more statefulness for sending out disconnect/release/release_complete messages. added support for incoming presentation/screening. fixed a bug that we generate TONE_EVENTS on hanguptone_indicatem, which caused asterisk to write blocking thread messages. added nodialtone option to prevent dialtone for always_immediate 

Modified:
    trunk/channels/chan_misdn.c
    trunk/channels/misdn/chan_misdn_config.h
    trunk/channels/misdn/isdn_lib.c
    trunk/channels/misdn_config.c
    trunk/configs/misdn.conf.sample

Modified: trunk/channels/chan_misdn.c
URL: http://svn.digium.com/view/asterisk/trunk/channels/chan_misdn.c?rev=37508&r1=37507&r2=37508&view=diff
==============================================================================
--- trunk/channels/chan_misdn.c (original)
+++ trunk/channels/chan_misdn.c Thu Jul 13 09:13:24 2006
@@ -2296,7 +2296,8 @@
 			hanguptone_indicate(p);
 		
 			if (bc->nt) {
-				misdn_lib_send_event( bc, EVENT_DISCONNECT);
+				if (bc->need_disconnect)
+					misdn_lib_send_event( bc, EVENT_DISCONNECT);
 			} else {
 				misdn_lib_send_event( bc, EVENT_RELEASE_COMPLETE);
 				p->state=MISDN_CLEANING;
@@ -2307,7 +2308,8 @@
 			start_bc_tones(p);
 			hanguptone_indicate(p);
 		
-			misdn_lib_send_event( bc, EVENT_DISCONNECT);
+			if (bc->need_disconnect)
+				misdn_lib_send_event( bc, EVENT_DISCONNECT);
 			break;
       
 		case MISDN_ALERTING:
@@ -2317,7 +2319,8 @@
 				hanguptone_indicate(p);
       
 			/*p->state=MISDN_CLEANING;*/
-			misdn_lib_send_event( bc, EVENT_DISCONNECT);
+			if (bc->need_disconnect)
+				misdn_lib_send_event( bc, EVENT_DISCONNECT);
 			break;
 		case MISDN_CONNECTED:
 			/*  Alerting or Disconect */
@@ -2326,7 +2329,8 @@
 				hanguptone_indicate(p);
 				p->bc->progress_indicator=8;
 			}
-			misdn_lib_send_event( bc, EVENT_DISCONNECT);
+			if (bc->need_disconnect)
+				misdn_lib_send_event( bc, EVENT_DISCONNECT);
 
 			/*p->state=MISDN_CLEANING;*/
 			break;
@@ -2358,7 +2362,8 @@
 				misdn_lib_send_event(bc, EVENT_RELEASE);
 				p->state=MISDN_CLEANING; 
 			} else {
-				misdn_lib_send_event(bc, EVENT_DISCONNECT);
+				if (bc->need_disconnect)
+					misdn_lib_send_event(bc, EVENT_DISCONNECT);
 			}
 		}
 
@@ -2674,6 +2679,16 @@
 {
 	const struct tone_zone_sound *ts= NULL;
 	struct ast_channel *ast=cl->ast;
+
+
+	int nd=0;
+	misdn_cfg_get( cl->bc->port, MISDN_CFG_NODIALTONE, &nd, sizeof(nd));
+
+	if (nd) {
+		chan_misdn_log(1,cl->bc->port,"Not sending Dialtone, because config wants it\n");
+		return 0;
+	}
+	
 	chan_misdn_log(3,cl->bc->port," --> Dial\n");
 	ts=ast_get_indication_tone(ast->zone,"dial");
 	cl->ts=ts;	
@@ -2692,7 +2707,6 @@
 static int hanguptone_indicate(struct chan_list *cl)
 {
 	misdn_lib_send_tone(cl->bc,TONE_HANGUP);
-	misdn_lib_tone_generator_start(cl->bc);
 	return 0;
 }
 
@@ -3707,12 +3721,38 @@
 		ch->ast->rings=1;
 		ast_setstate(ch->ast, AST_STATE_RINGING);
 
-		if ( bc->pres ) {
-			chan->cid.cid_pres=AST_PRES_ALLOWED_USER_NUMBER_NOT_SCREENED;
-		}  else {
-			chan->cid.cid_pres=AST_PRES_ALLOWED_USER_NUMBER_PASSED_SCREEN;
-		}
-      
+		int pres,screen;
+
+		switch (bc->pres) {
+			case 1:
+			pres=AST_PRES_RESTRICTED; chan_misdn_log(2,bc->port," --> PRES: Restricted (1)\n");
+			break;
+			case 2:
+			pres=AST_PRES_UNAVAILABLE; chan_misdn_log(2,bc->port," --> PRES: Restricted (2)\n");
+			break;
+			default:
+			pres=AST_PRES_ALLOWED; chan_misdn_log(2,bc->port," --> PRES: Restricted (%d)\n", bc->pres);
+		}
+
+		switch (bc->screen) {
+			case 0:
+			screen=AST_PRES_USER_NUMBER_UNSCREENED;  chan_misdn_log(2,bc->port," --> SCREEN: Unscreened (0)\n");
+			break;
+			case 1:
+			screen=AST_PRES_USER_NUMBER_PASSED_SCREEN; chan_misdn_log(2,bc->port," --> SCREEN: Passed screen (1)\n");
+			break;
+			case 2:
+			screen=AST_PRES_USER_NUMBER_FAILED_SCREEN; chan_misdn_log(2,bc->port," --> SCREEN: failed screen (2)\n");
+			break;
+			case 3:
+			screen=AST_PRES_NETWORK_NUMBER; chan_misdn_log(2,bc->port," --> SCREEN: Network Number (3)\n");
+			break;
+			default:
+			screen=AST_PRES_USER_NUMBER_UNSCREENED; chan_misdn_log(2,bc->port," --> SCREEN: Unscreened (%d)\n",bc->screen);
+		}
+
+		chan->cid.cid_pres=pres+screen;
+
 		pbx_builtin_setvar_helper(chan, "TRANSFERCAPABILITY", ast_transfercapability2str(bc->capability));
 		chan->transfercapability=bc->capability;
 		

Modified: trunk/channels/misdn/chan_misdn_config.h
URL: http://svn.digium.com/view/asterisk/trunk/channels/misdn/chan_misdn_config.h?rev=37508&r1=37507&r2=37508&view=diff
==============================================================================
--- trunk/channels/misdn/chan_misdn_config.h (original)
+++ trunk/channels/misdn/chan_misdn_config.h Thu Jul 13 09:13:24 2006
@@ -44,6 +44,7 @@
 	MISDN_CFG_PRES,                /* int */
 	MISDN_CFG_SCREEN,              /* int */
 	MISDN_CFG_ALWAYS_IMMEDIATE,    /* int (bool) */
+	MISDN_CFG_NODIALTONE,    /* int (bool) */
 	MISDN_CFG_IMMEDIATE,           /* int (bool) */
 	MISDN_CFG_SENDDTMF,           /* int (bool) */
 	MISDN_CFG_HOLD_ALLOWED,        /* int (bool) */

Modified: trunk/channels/misdn/isdn_lib.c
URL: http://svn.digium.com/view/asterisk/trunk/channels/misdn/isdn_lib.c?rev=37508&r1=37507&r2=37508&view=diff
==============================================================================
--- trunk/channels/misdn/isdn_lib.c (original)
+++ trunk/channels/misdn/isdn_lib.c Thu Jul 13 09:13:24 2006
@@ -3195,6 +3195,7 @@
 			cb_log(-1,bc->port," --> we have already send Release\n");
 			return -1;
 		}
+		bc->need_disconnect=0;
 		bc->need_release=0;
 		break;
 	case EVENT_RELEASE_COMPLETE:
@@ -3202,6 +3203,8 @@
 			cb_log(-1,bc->port," --> we have already send Release_complete\n");
 			return -1;
 		}
+		bc->need_disconnect=0;
+		bc->need_release=0;
 		bc->need_release_complete=0;
 		break;
     

Modified: trunk/channels/misdn_config.c
URL: http://svn.digium.com/view/asterisk/trunk/channels/misdn_config.c?rev=37508&r1=37507&r2=37508&view=diff
==============================================================================
--- trunk/channels/misdn_config.c (original)
+++ trunk/channels/misdn_config.c Thu Jul 13 09:13:24 2006
@@ -210,6 +210,10 @@
 		"\tThere you can use DigitTimeout if you can't or don't want to use\n"
 		"\tisdn overlap dial.\n"
 		"\tNOTE: This will jump into the s extension for every exten!" },
+	{ "nodialtone", MISDN_CFG_NODIALTONE, MISDN_CTYPE_BOOL, "no", NONE,
+		"Enable this to prevent chan_misdn to generate the dialtone\n"
+		"\tThis makes only sense together with the always_immediate=yes option\n"
+		"\tto generate your own dialtone with Playtones or so.\n"},
 	{ "immediate", MISDN_CFG_IMMEDIATE, MISDN_CTYPE_BOOL, "no", NONE,
 		"Enable this if you want callers which called exactly the base\n"
 		"\tnumber (so no extension is set) to jump into the s extension.\n"

Modified: trunk/configs/misdn.conf.sample
URL: http://svn.digium.com/view/asterisk/trunk/configs/misdn.conf.sample?rev=37508&r1=37507&r2=37508&view=diff
==============================================================================
--- trunk/configs/misdn.conf.sample (original)
+++ trunk/configs/misdn.conf.sample Thu Jul 13 09:13:24 2006
@@ -272,6 +272,15 @@
 ;
 ;always_immediate=no
 
+;
+; set this to yes if you want to generate your own dialtone 
+; with always_immediate=yes, else chan_misdn generates the dialtone
+;
+; default value: no
+;
+nodialtone=no
+
+
 ; uncomment the following if you want callers which called exactly the 
 ; base number (so no extension is set) jump to the s extension.
 ; if the user dials something more it jumps to the correct extension 



More information about the asterisk-commits mailing list