Skip to content

Commit

Permalink
removing beep_timeout
Browse files Browse the repository at this point in the history
  • Loading branch information
maxkahan committed May 16, 2023
1 parent be341ce commit 051be4f
Show file tree
Hide file tree
Showing 4 changed files with 4 additions and 14 deletions.
4 changes: 0 additions & 4 deletions src/vonage/ncco_builder/ncco.py
Original file line number Diff line number Diff line change
Expand Up @@ -110,10 +110,6 @@ def validate_advancedMachineDetection(cls, v):
raise ValueError('advancedMachineDetection["behavior"] must be one of: "continue", "hangup".')
if 'mode' in v and v['mode'] not in ('detect, detect_beep'):
raise ValueError('advancedMachineDetection["mode"] must be one of: "detect", "detect_beep".')
if 'beep_timeout' in v and type(v['beep_timeout']) != int:
raise ValueError('advancedMachineDetection["beep_timeout"] must be an integer.')
if 'beep_timeout' in v and (v['beep_timeout'] < 45 or v['beep_timeout'] > 120):
raise ValueError('advancedMachineDetection["beep_timeout"] must be >= 45 or <= 120.')
return v

class Config:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@

connect_full = '{"action": "connect", "endpoint": [{"type": "phone", "number": "447000000000"}], "from": "447400000000", "randomFromNumber": false, "eventType": "synchronous", "timeout": 15, "limit": 1000, "machineDetection": "hangup", "eventUrl": ["http://example.com"], "eventMethod": "PUT", "ringbackTone": "http://example.com"}'

connect_advancedMachineDetection = '{"action": "connect", "endpoint": [{"type": "phone", "number": "447000000000"}], "from": "447400000000", "advancedMachineDetection": {"behavior": "continue", "mode": "detect", "beep_timeout": 45}, "eventUrl": ["http://example.com"]}'
connect_advancedMachineDetection = '{"action": "connect", "endpoint": [{"type": "phone", "number": "447000000000"}], "from": "447400000000", "advancedMachineDetection": {"behavior": "continue", "mode": "detect"}, "eventUrl": ["http://example.com"]}'

talk_basic = '{"action": "talk", "text": "hello"}'

Expand Down
4 changes: 2 additions & 2 deletions tests/test_ncco_builder/ncco_samples/ncco_builder_samples.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@

connect_advancedMachineDetection = Ncco.Connect(
endpoint=ConnectEndpoints.PhoneEndpoint(number='447000000000'),
advancedMachineDetection={'behavior': 'continue', 'mode': 'detect', 'beep_timeout': 45},
advancedMachineDetection={'behavior': 'continue', 'mode': 'detect'},
)


Expand Down Expand Up @@ -80,7 +80,7 @@
{
'action': 'connect',
'endpoint': [{'type': 'phone', 'number': '447000000000'}],
'advancedMachineDetection': {'behavior': 'continue', 'mode': 'detect', 'beep_timeout': 45},
'advancedMachineDetection': {'behavior': 'continue', 'mode': 'detect'},
},
{'action': 'talk', 'text': 'hello'},
]
Expand Down
8 changes: 1 addition & 7 deletions tests/test_ncco_builder/test_ncco_actions.py
Original file line number Diff line number Diff line change
Expand Up @@ -126,7 +126,7 @@ def test_connect_options():


def test_connect_advanced_machine_detection():
advancedMachineDetectionParams = {'behavior': 'continue', 'mode': 'detect', 'beep_timeout': 45}
advancedMachineDetectionParams = {'behavior': 'continue', 'mode': 'detect'}
endpoint = ConnectEndpoints.PhoneEndpoint(number='447000000000')
connect = Ncco.Connect(
endpoint=endpoint,
Expand Down Expand Up @@ -159,12 +159,6 @@ def test_connect_validation_errors():
Ncco.Connect(endpoint=endpoint, advancedMachineDetection={'behavior': 'do_nothing'})
with pytest.raises(ValidationError):
Ncco.Connect(endpoint=endpoint, advancedMachineDetection={'mode': 'detect_nothing'})
with pytest.raises(ValidationError):
Ncco.Connect(endpoint=endpoint, advancedMachineDetection={'beep_timeout': '100'})
with pytest.raises(ValidationError):
Ncco.Connect(endpoint=endpoint, advancedMachineDetection={'beep_timeout': 10})
with pytest.raises(ValidationError):
Ncco.Connect(endpoint=endpoint, advancedMachineDetection={'beep_timeout': 1000})


def test_talk_basic():
Expand Down

0 comments on commit 051be4f

Please sign in to comment.