55
66from ..errors import VoiceError
77from .common import AdvancedMachineDetection
8- from .enums import Channel
9- from .ncco import NccoAction
8+ from .enums import CallStatus , Channel
9+ from .ncco import Record , Conversation , Connect , Input , Talk , Stream , Notify
1010
1111
1212class Phone (BaseModel ):
@@ -37,11 +37,12 @@ class Vbc(BaseModel):
3737 type : Channel = Channel .VBC
3838
3939
40- class Call (BaseModel ):
41- ncco : List [NccoAction ] = None
40+ class CreateCallRequest (BaseModel ):
41+ ncco : List [Union [ Record , Conversation , Connect , Input , Talk , Stream , Notify ] ] = None
4242 answer_url : List [str ] = None
4343 answer_method : Optional [Literal ['POST' , 'GET' ]] = None
4444 to : List [Union [ToPhone , Sip , Websocket , Vbc ]]
45+
4546 from_ : Optional [Phone ] = Field (None , serialization_alias = 'from' )
4647 random_from_number : Optional [bool ] = None
4748 event_url : Optional [List [str ]] = None
@@ -57,12 +58,6 @@ def validate_ncco_and_answer_url(self):
5758 raise VoiceError ('Either `ncco` or `answer_url` must be set' )
5859 if self .ncco is not None and self .answer_url is not None :
5960 raise VoiceError ('`ncco` and `answer_url` cannot be used together' )
60- if (
61- self .ncco is not None
62- and self .answer_url is None
63- and self .answer_method is not None
64- ):
65- self .answer_method = None
6661 return self
6762
6863 @model_validator (mode = 'after' )
@@ -72,3 +67,13 @@ def validate_from_and_random_from_number(self):
7267 if self .random_from_number == True and self .from_ is not None :
7368 raise VoiceError ('`from_` and `random_from_number` cannot be used together' )
7469 return self
70+
71+
72+ class ListCallsFilter (BaseModel ):
73+ status : Optional [CallStatus ] = None
74+ date_start : Optional [str ] = None
75+ date_end : Optional [str ] = None
76+ page_size : Optional [int ] = Field (None , ge = 1 , le = 100 )
77+ record_index : Optional [int ] = None
78+ order : Optional [Literal ['asc' , 'desc' ]] = None
79+ conversation_uuid : Optional [str ] = None
0 commit comments