[svn-commits] branch crichter/0.3.0 r37507 - in /team/crichter/0.3.0: channels/ channels/mi...

svn-commits at lists.digium.com svn-commits at lists.digium.com
Thu Jul 13 07:07:29 MST 2006


Author: crichter
Date: Thu Jul 13 09:07:28 2006
New Revision: 37507

URL: http://svn.digium.com/view/asterisk?rev=37507&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:
    team/crichter/0.3.0/channels/chan_misdn.c
    team/crichter/0.3.0/channels/misdn/chan_misdn_config.h
    team/crichter/0.3.0/channels/misdn/isdn_lib.c
    team/crichter/0.3.0/channels/misdn_config.c
    team/crichter/0.3.0/configs/misdn.conf.sample

Modified: team/crichter/0.3.0/channels/chan_misdn.c
URL: http://svn.digium.com/view/asterisk/team/crichter/0.3.0/channels/chan_misdn.c?rev=37507&r1=37506&r2=37507&view=diff
==============================================================================
--- team/crichter/0.3.0/channels/chan_misdn.c (original)
+++ team/crichter/0.3.0/channels/chan_misdn.c Thu Jul 13 09:07:28 2006
@@ -1967,7 +1967,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;
@@ -1978,7 +1979,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:
@@ -1988,7 +1990,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 */
@@ -1997,7 +2000,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;
@@ -2029,7 +2033,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);
 			}
 		}
 
@@ -2298,6 +2303,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;	
@@ -2316,7 +2331,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;
 }
 
@@ -3300,12 +3314,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: team/crichter/0.3.0/channels/misdn/chan_misdn_config.h
URL: http://svn.digium.com/view/asterisk/team/crichter/0.3.0/channels/misdn/chan_misdn_config.h?rev=37507&r1=37506&r2=37507&view=diff
==============================================================================
--- team/crichter/0.3.0/channels/misdn/chan_misdn_config.h (original)
+++ team/crichter/0.3.0/channels/misdn/chan_misdn_config.h Thu Jul 13 09:07:28 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: team/crichter/0.3.0/channels/misdn/isdn_lib.c
URL: http://svn.digium.com/view/asterisk/team/crichter/0.3.0/channels/misdn/isdn_lib.c?rev=37507&r1=37506&r2=37507&view=diff
==============================================================================
--- team/crichter/0.3.0/channels/misdn/isdn_lib.c (original)
+++ team/crichter/0.3.0/channels/misdn/isdn_lib.c Thu Jul 13 09:07:28 2006
@@ -3183,6 +3183,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:
@@ -3190,6 +3191,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: team/crichter/0.3.0/channels/misdn_config.c
URL: http://svn.digium.com/view/asterisk/team/crichter/0.3.0/channels/misdn_config.c?rev=37507&r1=37506&r2=37507&view=diff
==============================================================================
--- team/crichter/0.3.0/channels/misdn_config.c (original)
+++ team/crichter/0.3.0/channels/misdn_config.c Thu Jul 13 09:07:28 2006
@@ -105,6 +105,7 @@
 	{ "presentation", MISDN_CFG_PRES, MISDN_CTYPE_INT, "-1", NONE },
 	{ "screen", MISDN_CFG_SCREEN, MISDN_CTYPE_INT, "-1", NONE },
 	{ "always_immediate", MISDN_CFG_ALWAYS_IMMEDIATE, MISDN_CTYPE_BOOL, "no", NONE },
+	{ "nodialtone", MISDN_CFG_NODIALTONE, MISDN_CTYPE_BOOL, "no", NONE },
 	{ "immediate", MISDN_CFG_IMMEDIATE, MISDN_CTYPE_BOOL, "no", NONE },
 	{ "senddtmf", MISDN_CFG_SENDDTMF, MISDN_CTYPE_BOOL, "no", NONE },
 	{ "hold_allowed", MISDN_CFG_HOLD_ALLOWED, MISDN_CTYPE_BOOL, "no", NONE },
@@ -326,10 +327,10 @@
 	}
 
 	misdn_cfg_lock();
-	if (port_cfg[port][MISDN_CFG_MSNS-1].ml)
-		iter = port_cfg[port][MISDN_CFG_MSNS-1].ml;
+	if (port_cfg[port][map[MISDN_CFG_MSNS]].ml)
+		iter = port_cfg[port][map[MISDN_CFG_MSNS]].ml;
 	else
-		iter = port_cfg[0][MISDN_CFG_MSNS-1].ml;
+		iter = port_cfg[0][map[MISDN_CFG_MSNS]].ml;
 	for (; iter; iter = iter->next) 
 		if (*(iter->msn) == '*' || ast_extension_match(iter->msn, msn)) {
 			re = 1;

Modified: team/crichter/0.3.0/configs/misdn.conf.sample
URL: http://svn.digium.com/view/asterisk/team/crichter/0.3.0/configs/misdn.conf.sample?rev=37507&r1=37506&r2=37507&view=diff
==============================================================================
--- team/crichter/0.3.0/configs/misdn.conf.sample (original)
+++ team/crichter/0.3.0/configs/misdn.conf.sample Thu Jul 13 09:07:28 2006
@@ -257,6 +257,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 svn-commits mailing list