22import json
33
44from messagebird .balance import Balance
5+ from messagebird .call import Call
56from messagebird .contact import Contact , ContactList
67from messagebird .error import Error
78from messagebird .group import Group , GroupList
2829CONVERSATION_WEB_HOOKS_PATH = 'webhooks'
2930CONVERSATION_TYPE = 'conversation'
3031
32+ VOICE_API_ROOT = 'https://voice.messagebird.com/'
33+ VOICE_TYPE = 'voice'
34+
3135
3236class ErrorException (Exception ):
3337 def __init__ (self , errors ):
@@ -48,6 +52,9 @@ def _get_http_client(self, type=REST_TYPE):
4852 if type == REST_TYPE :
4953 return HttpClient (ENDPOINT , self .access_key , USER_AGENT )
5054
55+ if type == VOICE_TYPE :
56+ return HttpClient (VOICE_API_ROOT , self .access_key , USER_AGENT )
57+
5158 return HttpClient (CONVERSATION_API_ROOT , self .access_key , USER_AGENT )
5259
5360 def request (self , path , method = 'GET' , params = None , type = REST_TYPE ):
@@ -86,6 +93,10 @@ def balance(self):
8693 """Retrieve your balance."""
8794 return Balance ().load (self .request ('balance' ))
8895
96+ def call (self ,id ):
97+ """Retrieve the information of a specific call"""
98+ return Call ().load (self .request ('calls/' + str (id ), 'GET' , None , VOICE_TYPE ))
99+
89100 def hlr (self , id ):
90101 """Retrieve the information of a specific HLR lookup."""
91102 return HLR ().load (self .request ('hlr/' + str (id )))
0 commit comments