Install using pip
...
pip install beeline-portal
from beeline_portal import BeelinePBX
client = BeelinePBX('<access_token>')
abonents = client.get_abonents() # return map[Abonent]
abonent = client.find_abonent('<pattern>') # raise BeelinePBXException or return Abonent
result = client.get_abonent_agent_status('<pattern>') # raise BeelinePBXException or return {'status': status}
_ = client.set_abonent_agent_status('<pattern>', 'status') # raise BeelinePBXException or return {}
result = client.get_abonent_recording_status('<pattern>') # raise BeelinePBXException or return {'status': status}
_ = client.enable_abonent_recording('<pattern>') # raise BeelinePBXException or return {}
_ = client.stop_abonent_recording('<pattern>') # raise BeelinePBXException or return {}
result = client.call_from_abonent('<pattern>', 'phone number') # raise BeelinePBXException or return {'response': response}
result = client.call_from_abonent_v2('<pattern>', 'phone number') # raise BeelinePBXException or return {'response': response}
result = client.transfer_call_from_abonent('<pattern>','call_id', 'phone number') # raise BeelinePBXException or return {}
result = client.transfer_call_with_consult('<pattern>','call_id', 'call_id_consult') # raise BeelinePBXException or return {}
result = client.transfer_call_with_consult('<pattern>','phone number', 'schedule') # raise BeelinePBXException or return {}
result = client.delete_extension_number('<pattern>') # raise BeelinePBXException or return {}
cfb_response = client.get_cfb('<pattern>') # raise BeelinePBXException or return CfbResponse
from beeline_protal.models import Cfb
cfb = Cfb('+7397999992', '+7397999993')
cfb_response = client.get_cfb('<pattern>', cfb) # raise BeelinePBXException or return CfbResponse
result = client.stop_cfb('<pattern>') # raise BeelinePBXException or return {}
result = client.get_cfs_rules('<pattern>') # raise BeelinePBXException or return CfsStatusResponse
from beeline_portal.models import CfsRule
cfs_rule = CfsRule('my rule', '+7937999992', 'WORKING_TIME', ['+7937999993'])
result = client.add_cfs_rule('<pattern>', cfs_rule) # raise BeelinePBXException or return {'number': response}
result = client.enable_cfs('<pattern>') # raise BeelinePBXException or return {}
from beeline_portal.models import CfsRule
cfs_rule = CfsRule('my rule', '+7937999992', 'WORKING_TIME', ['+7937999993'])
result = client.update_cfs_rule('<pattern>','cfs_id', cfs_rule) # raise BeelinePBXException or return {}
result = client.stop_cfs('<pattern>') # raise BeelinePBXException or return {}
result = client.delete_cfs_rule('<pattern>', '<cfs_id>') # raise BeelinePBXException or return {}
result = client.get_bwl_list('<pattern>') # raise BeelinePBXException or return BwlStatusResponse
from beeline_portal.models import BwlRule
bwl_rule = BwlRule('BWL_RULE', 'WORKING_TIME', ['+7939797772'])
result = client.add_bwl_rule('<pattern>', 'WHITE_LIST', bwl_rule) # raise BeelinePBXException or return {'number': response}
from beeline_portal.models import BwlRule
bwl_rule = BwlRule('BWL_RULE', 'WORKING_TIME', ['+7939797772'])
result = client.update_bwl_rule('<pattern>', '<bwl_id>', bwl_rule) # raise BeelinePBXException or return {}
result = client.enable_bwl('<pattern>', '<rule_type>') # raise BeelinePBXException or return {}
result = client.stop_bwl('<pattern>') # raise BeelinePBXException or return {}
result = client.delete_bwl_rule('<pattern>', '<bwl_id>') # raise BeelinePBXException or return {}
call_records = client.get_records() #raise BeelinePBXException or return map[CallRecord]
result = client.delete_record('<record_id>') #raise BeelinePBXException or return {}
call_record = client.get_record('<record_id>') #raise BeelinePBXException or return CallRecord
call_record = client.get_record_by_extratracking_id('<extratracking_id>', '<user_id>') #raise BeelinePBXException or return CallRecord
bytes_record_data = client.download_record('<record_id>') #raise BeelinePBXException or return record data in bytes
bytes_record_data = client.download_record_by_extracking_id('<extratracking_id>', '<user_id>') #raise BeelinePBXException or return record data in bytes
record_link = client.get_record_link('<record_id>') #raise BeelinePBXException or return string
record_link = client.get_record_link_by_extracking_id('<extratracking_id>', '<user_id>') #raise BeelinePBXException or return string
incoming_numbers = client.get_incoming_numbers() #raise BeelinePBXException or return map[Number]
inc_number = client.find_incoming_number('<pattern>') #raise BeelinePBXException or return Number
from beeline_portal.models import SubscriptionRequest
sr = SubscriptionRequest('<pattern>', 23,'BASIC_CALL', '<url>')
result = client.create_subscription(sr) #raise BeelinePBXException or return dict
subs = client.get_subscription('<subscription_id>') #raise BeelinePBXException or return Subscription
subs = client.stop_subscrption('<subscription_id>') #raise BeelinePBXException or return {}
icr_numbers = client.get_icr_numbers() #raise BeelinePBXException or return map[Number]
result = client.enable_icr_for_number(['+79238458793']) #raise BeelinePBXException or return map[IcrNumbersResult]
result = client.stop_icr_for_number(['+79238458793']) #raise BeelinePBXException or return map[IcrNumbersResult]
icr_route_rules = client.get_icr_route_rules() #raise BeelinePBXException or return map[IcrRouteRule]
from beeline_portal.models import IcrRouteRule
rule = IcrRouteRule('+7923424535', '201')
icr_route_rules = client.delete_list_of_icr_rules([rule]) #raise BeelinePBXException or return map[IcrRouteResult]
from beeline_portal.models import IcrRouteRule
rule = IcrRouteRule('+7923424535', '201')
icr_route_rules = client.add_list_of_icr_rules([rule]) #raise BeelinePBXException or return map[IcrRouteResult]
from beeline_portal.models import IcrRouteRule
rule = IcrRouteRule('+7923424535', '201')
icr_route_rules = client.update_list_of_icr_rules([rule]) #raise BeelinePBXException or return map[IcrRouteResult]
campaigns = client.get_voice_campaigns() #raise BeelinePBXException or return map[VoiceCampaign]
result = client.upload_file_to_voice_campaign('<path to file>') # raise BeelinePBXException or return {"id": "<id>"}
from beeline_portal.models import VoiceCampaignQuestion, Answer, DateAndTime
answers = [Answer('Q1', 'gadget')]
schedule = VoiceCampaignSchedule('Q1', 'H1', 'H4', 'BUSINESS_DAY')
from_ = DateAndTime(parse_datetime('2021-11-11'), '00:00')
to_ = DateAndTime(parse_datetime('2021-11-21'), '00:00')
campaign = VoiceCampaignQuestion(
'q_campaign',
answers,
"<file>",
['+793799992'],
'+7123212432',
schedule,
from_,
to_,
)
result = client.add_question_type_voice_campaign(campaign) # raise BeelinePBXException or return string number
from beeline_portal.models import VoiceCampaignMessage
campaign = VoiceCampaignMessage.from_beeline_struct({
"name": "Message campaign",
"audioFile": "file_id",
"phones": ["200"],
"phoneNumber": "+79379999992",
"schedule": {
"tryQuantity": "Q1",
"fromHour":"H1",
"toHour":"H4",
"schedule":"BUSINESS_DAY"
},
"from": {
"date": "2021-01-01",
"time":"00:00:23"
},
"to": {
"date": "2021-01-01",
"time":"00:00:23"
}
})
result = client.add_message_type_voice_campaign(campaign) # raise BeelinePBXException or return string number
from beeline_portal.models import VoiceCampaign
vc = VoiceCampaign.from_beeline_struct(
{
"name": "MyVoiceCampaign",
"status": "SUSPENDED",
"recordId": "hhyth1231432",
"type": "QUESTION",
"answers": [{"choice": "B1", "answer": "test"}],
"audioFile": "<link>",
"phones": ["93799992"],
"phoneNumber": "+799999999",
"schedule": {
"tryQuantity": "Q1",
"fromHour": "H0",
"toHour": "H4",
"schedule": "ALL_WEEK",
},
"from": {"date": "2021-01-01", "time": "00:00:00"},
"to": {"date": "2021-12-01", "time": "23:59:59"},
"abonent": {
"userId": "[email protected]",
"phone": "9379992",
"firstName": "Ivan",
"lastName": "Moody",
},
})
result = client.update_voice_campaign('<campaign_id>', vc)
result = client.delete_voice_campaign('<campaign_id>') # raise BeelinePBXException or return {}
result = client.stop_voice_campaign('<campaign_id>') # raise BeelinePBXException or return {}
result = client.start_voice_campaign('<campaign_id>') # raise BeelinePBXException or return {}
vc_info_report = client.get_voice_campaign_info('<campaign_id>') # raise BeelinePBXException or return VoiceCampaignInfoReport
from datetime import datetime, timedelta
date_to = datetime.now()
date_from = date_to - timedelta(days=2)
statistic = client.get_statistic('<user_id>', date_from, date_to, 0, 10) # raise BeelinePBXException or return map[StatRecord]
from datetime import datetime, timedelta
date_to = datetime.now()
date_from = date_to - timedelta(days=2)
statistic = client.get_statistic_v2('<user_id>', date_from, date_to, 0, 10) # raise BeelinePBXException or return map[StatRecordV2]