|
@@ -18,6 +18,11 @@ class DialOutDialog extends Component {
|
18
|
18
|
* @static
|
19
|
19
|
*/
|
20
|
20
|
static propTypes = {
|
|
21
|
+ /**
|
|
22
|
+ * The redux state representing the list of dial-out codes.
|
|
23
|
+ */
|
|
24
|
+ _dialOutCodes: React.PropTypes.array,
|
|
25
|
+
|
21
|
26
|
/**
|
22
|
27
|
* Property indicating if a dial number is allowed.
|
23
|
28
|
*/
|
|
@@ -176,15 +181,23 @@ class DialOutDialog extends Component {
|
176
|
181
|
* @returns {void}
|
177
|
182
|
*/
|
178
|
183
|
_onDialNumberChange(dialCode, dialInput) {
|
179
|
|
- // We remove all starting zeros from the dial input before attaching it
|
180
|
|
- // to the country code.
|
181
|
|
- const formattedDialInput = dialInput.replace(/^(0+)/, '');
|
|
184
|
+ let formattedDialInput, formattedNumber;
|
182
|
185
|
|
183
|
|
- const dialNumber = `${dialCode}${formattedDialInput}`;
|
|
186
|
+ // if there are no dial out codes it is possible they are disabled
|
|
187
|
+ // so we get the input as is, it can be just a sip address
|
|
188
|
+ if (this.props._dialOutCodes) {
|
|
189
|
+ // We remove all starting zeros from the dial input before attaching
|
|
190
|
+ // it to the country code.
|
|
191
|
+ formattedDialInput = dialInput.replace(/^(0+)/, '');
|
184
|
192
|
|
185
|
|
- const formattedNumber = this._formatDialNumber(dialNumber);
|
|
193
|
+ const dialNumber = `${dialCode}${formattedDialInput}`;
|
186
|
194
|
|
187
|
|
- this.props.checkDialNumber(formattedNumber);
|
|
195
|
+ formattedNumber = this._formatDialNumber(dialNumber);
|
|
196
|
+
|
|
197
|
+ this.props.checkDialNumber(formattedNumber);
|
|
198
|
+ } else {
|
|
199
|
+ formattedNumber = formattedDialInput = dialInput;
|
|
200
|
+ }
|
188
|
201
|
|
189
|
202
|
this.setState({
|
190
|
203
|
dialNumber: formattedNumber,
|
|
@@ -205,9 +218,17 @@ class DialOutDialog extends Component {
|
205
|
218
|
* }}
|
206
|
219
|
*/
|
207
|
220
|
function _mapStateToProps(state) {
|
208
|
|
- const { isDialNumberAllowed } = state['features/dial-out'];
|
|
221
|
+ const { dialOutCodes, isDialNumberAllowed } = state['features/dial-out'];
|
209
|
222
|
|
210
|
223
|
return {
|
|
224
|
+ /**
|
|
225
|
+ * List of dial-out codes.
|
|
226
|
+ *
|
|
227
|
+ * @private
|
|
228
|
+ * @type {array}
|
|
229
|
+ */
|
|
230
|
+ _dialOutCodes: dialOutCodes,
|
|
231
|
+
|
211
|
232
|
/**
|
212
|
233
|
* Property indicating if a dial number is allowed.
|
213
|
234
|
*
|