Objects Description¶
Phonebook
¶
-
class
dialer_contact.models.
Phonebook
(*args, **kwargs)¶ This defines the Phonebook
Attributes:
name
- phonebook name.description
- description about the phonebook.
Relationships:
user
- Foreign key relationship to the User model. Each phonebook is assigned to a User
Name of DB table: dialer_phonebook
-
phonebook_contacts
()¶ This will return a count of the contacts in the phonebook
Contact
¶
-
class
dialer_contact.models.
Contact
(*args, **kwargs)¶ This defines the Contact
Attributes:
contact
- Contact nolast_name
- Contact’s last namefirst_name
- Contact’s first nameemail
- Contact’s e-mail addresscity
- city namedescription
- description about a Contactstatus
- contact statusadditional_vars
- Additional variables
Relationships:
phonebook
- Foreign key relationship to the Phonebook model. Each contact mapped with a phonebookcountry
- Foreign key relationship to the Country model. Each contact mapped with a country
Name of DB table: dialer_contact
-
contact_name
()¶ Return Contact Name
-
replace_tag
(text)¶ Replace tag by contact values. This function will replace all the following tags:
{last_name} {first_name} {email} {country} {city} {phone_number}as well as, get additional_vars, and replace json tags
CampaignManager
¶
-
class
dialer_campaign.models.
CampaignManager
¶ Campaign Manager
-
get_expired_campaign
()¶ Return all the campaigns which are expired or going to expire based on the expiry date but status is not ‘END’
-
get_running_campaign
()¶ Return all the active campaigns which will be running based on the expiry date, the daily start/stop time and days of the week
-
Campaign
¶
-
class
dialer_campaign.models.
Campaign
(*args, **kwargs)¶ This defines the Campaign
Attributes:
campaign_code
- Auto-generated campaign code to identify the campaignname
- Campaign namedescription
- Description about the Campaignstatus
- Campaign statuscallerid
- Caller IDstartingdate
- Starting date of the Campaignexpirationdate
- Expiry date of the Campaigndaily_start_time
- Start timedaily_stop_time
- End timeweek_day_setting
(monday, tuesday, wednesday, thursday, friday, saturday, sunday)frequency
- Frequency, speed of the campaign. number of calls/mincallmaxduration
- Max call duration allowedmaxretry
- Max retry allowed per userintervalretry
- Time to wait between retries in secondscompletion_maxretry
- Number of retries until a contact completes surveycompletion_intervalretry
- Time delay in seconds before retrying contact to complete surveycalltimeout
- Number of seconds to timeout on dialingaleg_gateway
- Gateway to use to reach the contactextra_data
- Additional data to pass to the applicationtotalcontact
- Total Contact for this campaigncompleted
- Total Contact that completed Call / Surveyhas_been_started
- campaign started flaghas_been_duplicated
- campaign duplicated flagvoicemail
- Enable Voicemail Detectionamd_behavior
- Detection Behavioursms_gateway
- Gateway to transport the SMS
Relationships:
content_type
- Defines the application (survey
) to use when the call is established on the A-Legobject_id
- Defines the object of content_type applicationcontent_object
- Used to define the Voice App or the Survey with generic ForeignKeyphonebook
- Many-To-Many relationship to the Phonebook model.user
- Foreign key relationship to the a User model. Each campaign assigned to a Uservoicemail_audiofile
- Foreign key relationship to the a AudioFile model.dnc
- Foreign key relationship to the a DNC model.
Name of DB table: dialer_campaign
-
get_active_callmaxduration
()¶ Get the active call max duration
-
get_active_contact
()¶ Get all the active Contacts from the phonebook
-
get_active_max_frequency
()¶ Get the active max frequency
-
get_campaign_type
()¶ Get campaign type
-
get_pending_subscriber_update
(*args, **kwargs)¶ Get all the pending subscribers from the campaign
Check if a contact is authorized
-
progress_bar
()¶ Progress bar generated based on no of contacts
-
subscriber_detail
()¶ This will link to subscribers who are associated with the campaign
-
update_campaign_status
()¶ Update the campaign’s status
For example, If campaign is active, you can change status to ‘Pause’ or ‘Stop’
Subscriber
¶
-
class
dialer_campaign.models.
Subscriber
(*args, **kwargs)¶ This defines the Contact imported to a Campaign
Attributes:
last_attempt
- last call attempt datecount_attempt
- Count the amount of call attemptcompletion_count_attempt
- Count the amount of attempt to call in order to achieve completionduplicate_contact
- copy of the contact phonenumberstatus
- subscriber status
Relationships:
contact
- Foreign key relationship to the Contact model.campaign
- Foreign key relationship to the Campaign model.
Name of DB table: dialer_subscriber
Callrequest
¶
-
class
dialer_cdr.models.
Callrequest
(*args, **kwargs)¶ This defines the call request, the dialer will read any new request and attempt to deliver the call.
Attributes:
request_uuid
- Unique idcall_time
- Total call timecall_type
- Call typestatus
- Call request statuscallerid
- Caller IDlast_attempt_time
-result
–timeout
-timelimit
-extra_dial_string
-phone_number
-parent_callrequest
-extra_data
-num_attempt
-hangup_cause
-
Relationships:
user
- Foreign key relationship to the User model. Each campaign assigned to a Usercontent_type
- Defines the application (voip_app
orsurvey
) to use when the call is established on the A-Legobject_id
- Defines the object of content_type applicationcontent_object
- Used to define the VoIP App or the Survey with generic ForeignKeyaleg_gateway
- Foreign key relationship to the Gateway model. Gateway to use to call the subscribersubscriber
- Foreign key relationship to the Subscriber Model.campaign
- Foreign key relationship to the Campaign model.
Name of DB table: dialer_callrequest
VoIPCall
¶
-
class
dialer_cdr.models.
VoIPCall
(*args, **kwargs)¶ This gives information of all the calls made with the carrier charges and revenue of each call.
Attributes:
callid
- callid of the phonecallcallerid
- CallerID used to call outphone_number
- Phone number contacteddialcode
- Dialcode of the phonenumberstarting_date
- Starting date of the callduration
- Duration of the callbillsec
-progresssec
-answersec
-waitsec
-disposition
- Disposition of the callhangup_cause
-hangup_cause_q850
-
Relationships:
user
- Foreign key relationship to the User model.used_gateway
- Foreign key relationship to the Gateway model.callrequest
- Foreign key relationship to the Callrequest model.
Name of DB table: dialer_cdr
-
destination_name
()¶ Return Recipient dialcode
-
min_duration
()¶ Return duration in min & sec
Gateway
¶
-
class
dialer_gateway.models.
Gateway
(*args, **kwargs)¶ This defines the trunk to deliver the Voip Calls. Each of the Gateways are routes that support different protocols and sets of rules to alter the dialed number.
Attributes:
name
- Gateway name.description
- Description about the Gateway.addprefix
- Add prefix.removeprefix
- Remove prefix.gateways
- “user/,user/”, # Gateway string to try dialing separated by comma. First in the list will be tried firstgateway_codecs
- “‘PCMA,PCMU’,’PCMA,PCMU’”, # Codec string as needed by FS for each gateway separated by commagateway_timeouts
- “10,10”, # Seconds to timeout in string for each gateway separated by commagateway_retries
- “2,1”, # Retry String for Gateways separated by comma, on how many times each gateway should be retriedoriginate_dial_string
- originate_dial_stringsecondused
-failover
-addparameter
-count_call
-count_in_use
-maximum_call
-status
- Gateway status
Name of DB table: dialer_gateway
DialerSetting
¶
-
class
dialer_settings.models.
DialerSetting
(*args, **kwargs)¶ This defines the settings to apply to a user
Attributes:
name
- Settings name.max_frequency
- Max frequency, speed of the campaign. This is the number of calls per minute.callmaxduration
- Max retries allowedmaxretry
- Max retries allowed per usermax_calltimeout
- Maximum number of seconds to timeout on callsmax_cpg
- Max Number of campaignsmax_subr_cpg
- Max Number of subscriberblacklist
- Used to blacklist phone numbers to be calledwhitelist
- Used to whitelist phone numbers to be called
Name of DB table: dialer_setting
Survey_abstract
¶
-
class
survey.models.
Survey_abstract
(*args, **kwargs)¶ This defines the Survey template
Attributes:
name
- survey name.description
- description about the survey.
Relationships:
user
- Foreign key relationship to the User model. Each survey is assigned to a User
Name of DB table: survey
Section_abstract
¶
-
class
survey.models.
Section_abstract
(*args, **kwargs)¶ This defines the question for survey
Attributes:
type
- section typequestion
- questionscript
- text that will be used for TTSaudiofile
- audio file to be use instead of TTSinvalid_audiofile
- audio to play when input is invalidretries
- amount of time to retry to get a valid inputtimeout
- time to wait for user inputkey_0
- on multi choice section, text for result on key 0key_1
- on multi choice section, text for result on key 1key_2
- on multi choice section, text for result on key 2key_3
- on multi choice section, text for result on key 3key_4
- on multi choice section, text for result on key 4key_5
- on multi choice section, text for result on key 5key_6
- on multi choice section, text for result on key 6key_7
- on multi choice section, text for result on key 7key_8
- on multi choice section, text for result on key 8key_9
- on multi choice section, text for result on key 9rating_laps
- From 1 to X, value to accept rating inputvalidate_number
- check if we want to valid the input on Enter Number sectionnumber_digits
- Number of digits to wait for on Enter Number sectionmin_number
- if validate_number the minimum number acceptedmax_number
- if validate_number the maximum number acceptedphonenumber
- phonenumber to dialout / call transferconfirm_script
- script that will be play to the called part on transferconfirm_key
- key to confirm the call tcompleted
- reaching this section will mark the subscriber as completedconference
- Conference Roomsms_text
- text to send via SMS
Relationships:
survey
- Foreign key relationship to the Survey model. Each survey question is assigned to a Surveyaudio_message
- Foreign key relationship to the AudioFile model.
Name of DB table: survey_question
-
build_dtmf_filter
()¶ Build the dtmf filter to capture digits
-
get_branching_count_per_section
()¶ Get branching count per section
Section_template
¶
-
class
survey.models.
Section_template
(*args, **kwargs)¶ This defines the question for survey section template
-
copy_section_branching_template
(section, new_survey_obj)¶ copy section template to section when starting campaign
-
copy_section_template
(new_survey_obj)¶ copy section template to section when starting campaign
-
Branching_abstract
¶
-
class
survey.models.
Branching_abstract
(*args, **kwargs)¶ This defines the response of the survey section
Attributes:
keys
- Key digit (DTMF entered by the calling party)
Relationships:
section
- Foreign key relationship to the Section. Each response is assigned to a Section
Branching
¶
-
class
survey.models.
Branching
(*args, **kwargs)¶ This defines the response of the survey section
Result
¶
-
class
survey.models.
Result
(*args, **kwargs)¶ This gives survey result
That will be difficult to scale for reporting One big issue is when the user update the survey in time, we need to keep an history somehow of the question/response
Ideally we can try to build 2 other table, survey_track_question (id, question_text), survey_track_response (id, response_text) Where question_text / response_text is unique
Attributes:
callrequest
- Call Requestsection
- survey questionresponse
- survey question’s response
Relationships:
campaign
- Foreign key relationship to the Campaign model. Each survey result is belonged to a Campaignsurvey
- Foreign key relationship to the Survey model. Each survey question is assigned to a Surveysection
- Foreign key relationship to the Section model. Each result is assigned to a Section
Name of DB table: result
ResultAggregate
¶
-
class
survey.models.
ResultAggregate
(*args, **kwargs)¶ This gives survey result aggregate, used to display survey result in a more efficient way
Name of DB table: result_aggregate
UserProfile
¶
-
class
user_profile.models.
UserProfile
(*args, **kwargs)¶ This defines extra features for the user
Relationships:
userprofile_gateway
- ManyToManydialersetting
- Foreign key relationship to the DialerSetting model.
Name of DB table: user_profile
CalendarSetting
¶
-
class
user_profile.models.
CalendarSetting
(*args, **kwargs)¶ This defines the Calender settings to apply to a ar_user
Attributes:
label
- Label for the Calendar Settingcallerid
- CallerID numbercaller_name
- Caller namecall_timeout
- call timeoutsurvey
- Foreign key relationship to the Surveyaleg_gateway
- Foreign key relationship to the Gateway model. Gateway to use to call the subscribersms_gateway
- Gateway to transport the SMSvoicemail
- Enable Voicemail Detectionamd_behavior
- Detection Behaviour
Relationships:
user
- Foreign key relationship to the a User model. CalendarSetting are assigned to a Uservoicemail_audiofile
- Foreign key relationship to the a AudioFile model.
Name of DB table: calendar_setting
CalendarUser
¶
-
class
user_profile.models.
CalendarUser
(*args, **kwargs)¶ Calendar User Model
CalendarUserProfile
¶
-
class
user_profile.models.
CalendarUserProfile
(*args, **kwargs)¶ This defines extra features for the AR_user
Attributes:
calendar_setting
- appointment reminder settings
Name of DB table: calendar_user_profile
Calendar
¶
-
class
appointment.models.calendars.
Calendar
(*args, **kwargs)¶ This is for grouping events so that batch relations can be made to all events. An example would be a project calendar.
name: the name of the calendar events: all the events contained within the calendar. >>> calendar = Calendar(name = ‘Test Calendar’) >>> calendar.save()
-
get_recent
(amount=5, in_datetime=<built-in method now of type object>, tzinfo=<UTC>)¶ This shortcut function allows you to get events that have started recently.
amount is the amount of events you want in the queryset. The default is 5.
in_datetime is the datetime you want to check against. It defaults to datetime.datetime.now
-
Event
¶
-
class
appointment.models.events.
Event
(*args, **kwargs)¶ This model stores meta data for a event
-
copy_event
(next_occurrence)¶ create new event with next occurrence
-
get_list_alarm
()¶ we will list alarm of an event
-
get_list_child
()¶ we will list childs of an event
-
get_next_occurrence
()¶ TODO: implement this
>>> rule = Rule(frequency="MONTHLY", name="Monthly") >>> rule.save() >>> event = Event(rule=rule, start=datetime.datetime(2008,1,1,tzinfo=pytz.utc), end=datetime.datetime(2008,1,2)) >>> event.rule <Rule: Monthly> >>> event.get_next_occurrence() 2008-02-02 00:00:00+00:00
-
get_occurrences
(start, end)¶ >>> rule = Rule(frequency="MONTHLY", name="Monthly") >>> rule.save() >>> event = Event(rule=rule, start=datetime.datetime(2008,1,1,tzinfo=pytz.utc), end=datetime.datetime(2008,1,2)) >>> event.rule <Rule: Monthly> >>> occurrences = event.get_occurrences(datetime.datetime(2008,1,24), datetime.datetime(2008,3,2)) >>> ["%s to %s" %(o.start, o.end) for o in occurrences] ['2008-02-01 00:00:00+00:00 to 2008-02-02 00:00:00+00:00', '2008-03-01 00:00:00+00:00 to 2008-03-02 00:00:00+00:00']
Ensure that if an event has no rule, that it appears only once.
>>> event = Event(start=datetime.datetime(2008,1,1,8,0), end=datetime.datetime(2008,1,1,9,0)) >>> occurrences = event.get_occurrences(datetime.datetime(2013,1,24), datetime.datetime(2014,3,2)) >>> ["%s to %s" %(o.start, o.end) for o in occurrences] []
-
occurrences_after
(after=None)¶ returns a generator that produces occurrences after the datetime
after
. Includes all of the persisted Occurrences.
-
update_last_child_status
(status)¶ we will search for the last created child of an event and update his status to the status value
Note for the integrators: We can pause an event for 12hours but after that we will have to stop and create the new event.
-
SMSCampaign
¶
-
class
mod_sms.models.
SMSCampaign
(*args, **kwargs)¶ This defines the SMSCampaign
Attributes:
campaign_code
- Auto-generated campaign code to identify the campaignname
- Campaign namedescription
- Description about the Campaignstatus
- Campaign statuscallerid
- Caller IDstartingdate
- Starting date of the Campaignexpirationdate
- Expiry date of the Campaigndaily_start_time
- Start timedaily_stop_time
- End timeweek_day_setting
(monday, tuesday, wednesday, thursday, friday, saturday, sunday)frequency
- Frequency, speed of the campaign. number of calls/minmaxretry
- Max retry allowed per userintervalretry
- Time to wait between retries in secondssms_gateway
- Gateway to transport the SMSextra_data
- Additional data to pass to the application
Relationships:
content_type
- Defines the application (voice_app
orsurvey
) to use when the call is established on the A-Legobject_id
- Defines the object of content_type applicationcontent_object
- Used to define the Voice App or the Survey with generic ForeignKeyphonebook
- Many-To-Many relationship to the Phonebook model.user
- Foreign key relationship to the a User model. Each campaign assigned to a User
Name of DB table: sms_campaign
-
common_sms_campaign_status
(status)¶ SMS Campaign Status (e.g. start | stop | abort | pause) needs to be changed. It is a common function for the admin and customer UI’s
Attributes:
status
- selected status for the sms campaign record
Logic Description:
- Selected SMS Campaign’s status needs to be changed. Changed status can be start, stop or pause.
- This function is used by
update_sms_campaign_status_admin()
&update_sms_campaign_status_cust()
-
count_contact_of_phonebook
(status=None)¶ Count the no. of Contacts in a phonebook
-
get_active_contact
()¶ Get all the active Contacts from the phonebook
-
get_active_contact_no_subscriber
()¶ List of active contacts that do not exist in Campaign Subscriber
-
get_active_max_frequency
()¶ Get the active max frequency
-
get_pending_subscriber
(limit=1000)¶ Get all the pending subscribers from the sms_campaign
-
get_pending_subscriber_update
(limit=1000, status=6)¶ Get all the pending subscribers from the campaign
Check if a contact is authorized
-
progress_bar
()¶ Progress bar generated based on no of contacts
-
sms_campaignsubscriber_detail
()¶ This will link to sms_campaign subscribers who are associated with the sms_campaign
-
update_sms_campaign_status
()¶ Update the sms_campaign’s status
For example, If campaign is active, you can change status to ‘Pause’ or ‘Stop’
SMSCampaignSubscriber
¶
-
class
mod_sms.models.
SMSCampaignSubscriber
(*args, **kwargs)¶ This defines the Contact imported to a SMSCampaign
Attributes:
last_attempt
-count_attempt
-duplicate_contact
-status
-
Relationships:
contact
- Foreign key relationship to the Contact model.campaign
- Foreign key relationship to the Campaign model.
Name of DB table: sms_campaign_subscriber
SMSMessage
¶
-
class
mod_sms.models.
SMSMessage
(*args, **kwargs)¶ extension on Message
Attributes:
Relationships:
message
- One to one relationship to the Message model.sms_campaign
- Foreign key relationship to the SMSCampaign model.
Name of DB table: message_smscampaign
SMSTemplate
¶
-
class
mod_sms.models.
SMSTemplate
(*args, **kwargs)¶ This table store the SMS Template