Skip to content
This repository

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
  • 4 commits
  • 8 files changed
  • 0 comments
  • 1 contributor
Sep 17, 2012
FreeSWITCH: Add preprocessor constant for default callerid number
SWITCH_DEFAULT_CLID_NUMBER and replace all occurrences
in the FreeSWITCH codebase.

Signed-off-by: Stefan Knoblich <stkn@openisdn.net>
416f026
mod_freetdm: Use new SWITCH_DEFAULT_CLID_NUMBER constant
Signed-off-by: Stefan Knoblich <stkn@openisdn.net>
e561709
ftmod_misdn: Discard incoming audio data if b-channel is not active
Silences the "Device or resource busy" error messages caused by the RX pipe
filling up.

Signed-off-by: Stefan Knoblich <stkn@openisdn.net>
bc414df
ftmod_misdn: Handle incoming PH_CONTROL_IND messages on b-channels
Also add a few more PH_CONTROL_IND message types.

Signed-off-by: Stefan Knoblich <stkn@openisdn.net>
715c538
2  libs/freetdm/mod_freetdm/mod_freetdm.c
@@ -1320,7 +1320,7 @@ static switch_call_cause_t channel_outgoing_channel(switch_core_session_t *sessi
1320 1320
 		callerid_num = switch_sanitize_number(switch_core_strdup(outbound_profile->pool, outbound_profile->caller_id_number));
1321 1321
 	}
1322 1322
 
1323  
-	if (!zstr(callerid_num) && !strcmp(callerid_num, "0000000000")) {
  1323
+	if (!zstr(callerid_num) && !strcmp(callerid_num, SWITCH_DEFAULT_CLID_NUMBER)) {
1324 1324
 		callerid_num = NULL;
1325 1325
 	}
1326 1326
 
67  libs/freetdm/src/ftmod/ftmod_misdn/ftmod_misdn.c
@@ -144,10 +144,36 @@ const static struct {
144 144
 } misdn_control_types[] = {
145 145
 #define MISDN_CONTROL_TYPE(x)	{ x, #x }
146 146
 	MISDN_CONTROL_TYPE(DTMF_HFC_COEF),
  147
+	MISDN_CONTROL_TYPE(DSP_CONF_JOIN),
  148
+	MISDN_CONTROL_TYPE(DSP_CONF_SPLIT),
  149
+	MISDN_CONTROL_TYPE(DSP_RECEIVE_OFF),
  150
+	MISDN_CONTROL_TYPE(DSP_RECEIVE_ON),
  151
+	MISDN_CONTROL_TYPE(DSP_ECHO_ON),
  152
+	MISDN_CONTROL_TYPE(DSP_ECHO_OFF),
  153
+	MISDN_CONTROL_TYPE(DSP_MIX_ON),
  154
+	MISDN_CONTROL_TYPE(DSP_MIX_OFF),
  155
+	MISDN_CONTROL_TYPE(DSP_DELAY),
  156
+	MISDN_CONTROL_TYPE(DSP_JITTER),
  157
+	MISDN_CONTROL_TYPE(DSP_TXDATA_ON),
  158
+	MISDN_CONTROL_TYPE(DSP_TXDATA_OFF),
  159
+	MISDN_CONTROL_TYPE(DSP_TX_DEJITTER),
  160
+	MISDN_CONTROL_TYPE(DSP_TX_DEJ_OFF),
  161
+	MISDN_CONTROL_TYPE(DSP_TONE_PATT_ON),
  162
+	MISDN_CONTROL_TYPE(DSP_TONE_PATT_OFF),
  163
+	MISDN_CONTROL_TYPE(DSP_VOL_CHANGE_TX),
  164
+	MISDN_CONTROL_TYPE(DSP_VOL_CHANGE_RX),
  165
+	MISDN_CONTROL_TYPE(DSP_BF_ENABLE_KEY),
  166
+	MISDN_CONTROL_TYPE(DSP_BF_DISABLE),
  167
+	MISDN_CONTROL_TYPE(DSP_BF_ACCEPT),
  168
+	MISDN_CONTROL_TYPE(DSP_BF_REJECT),
  169
+	MISDN_CONTROL_TYPE(DSP_PIPELINE_CFG),
  170
+	MISDN_CONTROL_TYPE(HFC_VOL_CHANGE_TX),
  171
+	MISDN_CONTROL_TYPE(HFC_VOL_CHANGE_RX),
  172
+	MISDN_CONTROL_TYPE(HFC_SPL_LOOP_ON),
  173
+	MISDN_CONTROL_TYPE(HFC_SPL_LOOP_OFF),
147 174
 #undef MISDN_CONTROL_TYPE
148 175
 };
149 176
 
150  
-#ifdef MISDN_DEBUG_EVENTS
151 177
 static const char *misdn_control2str(const int ctrl)
152 178
 {
153 179
 	int x;
@@ -158,7 +184,6 @@ static const char *misdn_control2str(const int ctrl)
158 184
 	}
159 185
 	return "unknown";
160 186
 }
161  
-#endif
162 187
 
163 188
 
164 189
 /***********************************************************************************
@@ -759,13 +784,11 @@ static ftdm_status_t misdn_get_ph_info(ftdm_channel_t *chan, struct ph_info *inf
759 784
 
760 785
 static int misdn_handle_ph_control_ind(ftdm_channel_t *chan, const struct mISDNhead *hh, const void *data, const int data_len)
761 786
 {
762  
-#ifdef MISDN_DEBUG_EVENTS
763 787
 	ftdm_log_chan(chan, FTDM_LOG_DEBUG,
764 788
 		"PH_CONTROL_IND:\n"
765  
-		"\tMessage:\t%s\n"
  789
+		"\tMessage:\t%s (%#x)\n"
766 790
 		"\tPayload:\t%d\n",
767  
-		misdn_control2str(hh->id), data_len);
768  
-#endif
  791
+		misdn_control2str(hh->id), hh->id, data_len);
769 792
 
770 793
 	switch (hh->id) {
771 794
 	case DTMF_HFC_COEF:
@@ -2265,18 +2288,21 @@ static ftdm_status_t handle_b_channel_event(ftdm_channel_t *chan)
2265 2288
 		int datalen = retval - MISDN_HEADER_LEN;
2266 2289
 		char *data  = buf    + MISDN_HEADER_LEN;
2267 2290
 
2268  
-		/* Convert audio data */
2269  
-		misdn_convert_audio_bits(data, datalen);
  2291
+		/* Discard incoming audio if not active */
  2292
+		if (!priv->active) {
  2293
+			/* Convert audio data */
  2294
+			misdn_convert_audio_bits(data, datalen);
2270 2295
 
2271  
-		/* Write audio into receive pipe */
2272  
-		if ((retval = write(priv->rx_audio_pipe_in, data, datalen)) < 0) {
2273  
-			ftdm_log_chan(chan, FTDM_LOG_ERROR, "mISDN failed to write audio data into rx pipe: %s\n",
2274  
-				strerror(errno));
2275  
-			return FTDM_FAIL;
2276  
-		} else if (retval < datalen) {
2277  
-			ftdm_log_chan(chan, FTDM_LOG_ERROR, "mISDN short write into rx pipe, written: %d, expected: %d\n",
2278  
-				retval, datalen);
2279  
-			return FTDM_FAIL;
  2296
+			/* Write audio into receive pipe */
  2297
+			if ((retval = write(priv->rx_audio_pipe_in, data, datalen)) < 0) {
  2298
+				ftdm_log_chan(chan, FTDM_LOG_ERROR, "mISDN failed to write audio data into rx pipe: %s\n",
  2299
+					strerror(errno));
  2300
+				return FTDM_FAIL;
  2301
+			} else if (retval < datalen) {
  2302
+				ftdm_log_chan(chan, FTDM_LOG_ERROR, "mISDN short write into rx pipe, written: %d, expected: %d\n",
  2303
+					retval, datalen);
  2304
+				return FTDM_FAIL;
  2305
+			}
2280 2306
 		}
2281 2307
 
2282 2308
 		/* Get receive buffer usage */
@@ -2348,6 +2374,13 @@ static ftdm_status_t handle_b_channel_event(ftdm_channel_t *chan)
2348 2374
 	case PH_ACTIVATE_IND:
2349 2375
 		priv->active = 1;
2350 2376
 		break;
  2377
+	case PH_CONTROL_IND: {
  2378
+		int datalen = retval - MISDN_HEADER_LEN;
  2379
+		char *data  = buf    + MISDN_HEADER_LEN;
  2380
+
  2381
+		misdn_handle_ph_control_ind(chan, mh, data, datalen);
  2382
+		break;
  2383
+	}
2351 2384
 	default:
2352 2385
 		ftdm_log_chan(chan, FTDM_LOG_ERROR, "mISDN received unknown/unhandled event primitive: (%d) %s\n",
2353 2386
 			mh->prim, misdn_event2str(mh->prim));
1  src/include/switch_types.h
@@ -108,6 +108,7 @@ SWITCH_BEGIN_EXTERN_C
108 108
 #define SWITCH_SEQ_CLEARSCR SWITCH_SEQ_ESC SWITCH_SEQ_CLEARSCR_CHAR SWITCH_SEQ_HOME
109 109
 #endif
110 110
 #define SWITCH_DEFAULT_CLID_NAME ""
  111
+#define SWITCH_DEFAULT_CLID_NUMBER "0000000000"
111 112
 #define SWITCH_DEFAULT_DTMF_DURATION 2000
112 113
 #define SWITCH_MIN_DTMF_DURATION 400
113 114
 #define SWITCH_MAX_DTMF_DURATION 192000
2  src/mod/applications/mod_conference/mod_conference.c
@@ -8223,7 +8223,7 @@ static conference_obj_t *conference_new(char *name, conf_xml_cfg_t cfg, switch_c
8223 8223
 
8224 8224
 	/* Caller ID Number */
8225 8225
 	if (zstr(caller_id_number)) {
8226  
-		caller_id_number = "0000000000";
  8226
+		caller_id_number = SWITCH_DEFAULT_CLID_NUMBER;
8227 8227
 	}
8228 8228
 
8229 8229
 	if (!pool) {
2  src/mod/endpoints/mod_rtmp/mod_rtmp.c
@@ -874,7 +874,7 @@ switch_call_cause_t rtmp_session_create_call(rtmp_session_t *rsession, switch_co
874 874
 	
875 875
 	caller_profile = switch_caller_profile_new(pool, switch_str_nil(auth_user), dialplan, 
876 876
 		SWITCH_DEFAULT_CLID_NAME, 
877  
-		!zstr(auth_user) ? auth_user : "0000000000", 
  877
+		!zstr(auth_user) ? auth_user : SWITCH_DEFAULT_CLID_NUMBER,
878 878
 		rsession->remote_address /* net addr */, 
879 879
 		NULL /* ani   */, 
880 880
 		NULL /* anii  */, 
4  src/mod/endpoints/mod_skinny/skinny_server.c
@@ -326,7 +326,7 @@ switch_status_t skinny_session_send_call_info(switch_core_session_t *session, li
326 326
 			zstr((caller_party_number = switch_channel_get_variable(channel, "caller_id_number"))) &&
327 327
 			zstr((caller_party_number = switch_channel_get_variable_partner(channel, "effective_caller_id_number"))) &&
328 328
 			zstr((caller_party_number = switch_channel_get_variable_partner(channel, "caller_id_number")))) {
329  
-		caller_party_number = "0000000000";
  329
+		caller_party_number = SWITCH_DEFAULT_CLID_NUMBER;
330 330
 	}
331 331
 	/* Called party */
332 332
 	if (zstr((called_party_name = switch_channel_get_variable(channel, "effective_callee_id_name"))) &&
@@ -340,7 +340,7 @@ switch_status_t skinny_session_send_call_info(switch_core_session_t *session, li
340 340
 			zstr((called_party_number = switch_channel_get_variable_partner(channel, "effective_callee_id_number"))) &&
341 341
 			zstr((called_party_number = switch_channel_get_variable_partner(channel, "callee_id_number"))) &&
342 342
 			zstr((called_party_number = switch_channel_get_variable(channel, "destination_number")))) {
343  
-		called_party_number = "0000000000";
  343
+		called_party_number = SWITCH_DEFAULT_CLID_NUMBER;
344 344
 	}
345 345
 	if (switch_channel_direction(channel) == SWITCH_CALL_DIRECTION_OUTBOUND) {
346 346
 		call_type = SKINNY_INBOUND_CALL;
2  src/switch_caller.c
@@ -66,7 +66,7 @@ SWITCH_DECLARE(switch_caller_profile_t *) switch_caller_profile_new(switch_memor
66 66
 	}
67 67
 
68 68
 	if (zstr(caller_id_number)) {
69  
-		caller_id_number = "0000000000";
  69
+		caller_id_number = SWITCH_DEFAULT_CLID_NUMBER;
70 70
 	}
71 71
 
72 72
 	profile_dup_clean(username, profile->username, pool);
2  src/switch_ivr_originate.c
@@ -2496,7 +2496,7 @@ SWITCH_DECLARE(switch_status_t) switch_ivr_originate(switch_core_session_t *sess
2496 2496
 							cid_name_override = SWITCH_DEFAULT_CLID_NAME;
2497 2497
 						}
2498 2498
 						if (!cid_num_override) {
2499  
-							cid_num_override = "0000000000";
  2499
+							cid_num_override = SWITCH_DEFAULT_CLID_NUMBER;
2500 2500
 						}
2501 2501
 
2502 2502
 						new_profile = switch_caller_profile_new(oglobals.pool,

No commit comments for this range

Something went wrong with that request. Please try again.