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 no
  • last_name - Contact’s last name
  • first_name - Contact’s first name
  • email - Contact’s e-mail address
  • city - city name
  • description - description about a Contact
  • status - contact status
  • additional_vars - Additional variables

Relationships:

  • phonebook - Foreign key relationship to the Phonebook model. Each contact mapped with a phonebook
  • country - 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 campaign
  • name - Campaign name
  • description - Description about the Campaign
  • status - Campaign status
  • callerid - Caller ID
  • startingdate - Starting date of the Campaign
  • expirationdate - Expiry date of the Campaign
  • daily_start_time - Start time
  • daily_stop_time - End time
  • week_day_setting (monday, tuesday, wednesday, thursday, friday, saturday, sunday)
  • frequency - Frequency, speed of the campaign. number of calls/min
  • callmaxduration - Max call duration allowed
  • maxretry - Max retry allowed per user
  • intervalretry - Time to wait between retries in seconds
  • completion_maxretry - Number of retries until a contact completes survey
  • completion_intervalretry - Time delay in seconds before retrying contact to complete survey
  • calltimeout - Number of seconds to timeout on dialing
  • aleg_gateway - Gateway to use to reach the contact
  • extra_data - Additional data to pass to the application
  • totalcontact - Total Contact for this campaign
  • completed - Total Contact that completed Call / Survey
  • has_been_started - campaign started flag
  • has_been_duplicated - campaign duplicated flag
  • voicemail - Enable Voicemail Detection
  • amd_behavior - Detection Behaviour
  • sms_gateway - Gateway to transport the SMS

Relationships:

  • content_type - Defines the application (survey) to use when the call is established on the A-Leg
  • object_id - Defines the object of content_type application
  • content_object - Used to define the Voice App or the Survey with generic ForeignKey
  • phonebook - Many-To-Many relationship to the Phonebook model.
  • user - Foreign key relationship to the a User model. Each campaign assigned to a User
  • voicemail_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

is_authorized_contact(dialersetting, str_contact)

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 date
  • count_attempt - Count the amount of call attempt
  • completion_count_attempt - Count the amount of attempt to call in order to achieve completion
  • duplicate_contact - copy of the contact phonenumber
  • status - 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 id
  • call_time - Total call time
  • call_type - Call type
  • status - Call request status
  • callerid - Caller ID
  • last_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 User
  • content_type - Defines the application (voip_app or survey) to use when the call is established on the A-Leg
  • object_id - Defines the object of content_type application
  • content_object - Used to define the VoIP App or the Survey with generic ForeignKey
  • aleg_gateway - Foreign key relationship to the Gateway model. Gateway to use to call the subscriber
  • subscriber - 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 phonecall
  • callerid - CallerID used to call out
  • phone_number - Phone number contacted
  • dialcode - Dialcode of the phonenumber
  • starting_date - Starting date of the call
  • duration - Duration of the call
  • billsec -
  • progresssec -
  • answersec -
  • waitsec -
  • disposition - Disposition of the call
  • hangup_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 first
  • gateway_codecs - “‘PCMA,PCMU’,’PCMA,PCMU’”, # Codec string as needed by FS for each gateway separated by comma
  • gateway_timeouts - “10,10”, # Seconds to timeout in string for each gateway separated by comma
  • gateway_retries - “2,1”, # Retry String for Gateways separated by comma, on how many times each gateway should be retried
  • originate_dial_string - originate_dial_string
  • secondused -
  • 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 allowed
  • maxretry - Max retries allowed per user
  • max_calltimeout - Maximum number of seconds to timeout on calls
  • max_cpg - Max Number of campaigns
  • max_subr_cpg - Max Number of subscriber
  • blacklist - Used to blacklist phone numbers to be called
  • whitelist - 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

Survey_template

class survey.models.Survey_template(*args, **kwargs)

This defines the Survey template

copy_survey_template(campaign_id=None)

copy survey template to survey when starting campaign

Survey

class survey.models.Survey(*args, **kwargs)

This defines the Survey

create_duplicate_survey(campaign_obj, new_campaign)

create duplicate survey

Section_abstract

class survey.models.Section_abstract(*args, **kwargs)

This defines the question for survey

Attributes:

  • type - section type
  • question - question
  • script - text that will be used for TTS
  • audiofile - audio file to be use instead of TTS
  • invalid_audiofile - audio to play when input is invalid
  • retries - amount of time to retry to get a valid input
  • timeout - time to wait for user input
  • key_0 - on multi choice section, text for result on key 0
  • key_1 - on multi choice section, text for result on key 1
  • key_2 - on multi choice section, text for result on key 2
  • key_3 - on multi choice section, text for result on key 3
  • key_4 - on multi choice section, text for result on key 4
  • key_5 - on multi choice section, text for result on key 5
  • key_6 - on multi choice section, text for result on key 6
  • key_7 - on multi choice section, text for result on key 7
  • key_8 - on multi choice section, text for result on key 8
  • key_9 - on multi choice section, text for result on key 9
  • rating_laps - From 1 to X, value to accept rating input
  • validate_number - check if we want to valid the input on Enter Number section
  • number_digits - Number of digits to wait for on Enter Number section
  • min_number - if validate_number the minimum number accepted
  • max_number - if validate_number the maximum number accepted
  • phonenumber - phonenumber to dialout / call transfer
  • confirm_script - script that will be play to the called part on transfer
  • confirm_key - key to confirm the call t
  • completed - reaching this section will mark the subscriber as completed
  • conference - Conference Room
  • sms_text - text to send via SMS

Relationships:

  • survey - Foreign key relationship to the Survey model. Each survey question is assigned to a Survey
  • audio_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

sortable_by

alias of Survey

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

Section

class survey.models.Section(*args, **kwargs)

This defines the question for survey section

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_template

class survey.models.Branching_template(*args, **kwargs)

This defines the response of the survey section

copy_branching_template(new_section, new_survey_obj)

copy branching template to branching when starting campaign

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 Request
  • section - survey question
  • response - survey question’s response

Relationships:

  • campaign - Foreign key relationship to the Campaign model. Each survey result is belonged to a Campaign
  • survey - Foreign key relationship to the Survey model. Each survey question is assigned to a Survey
  • section - 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 - ManyToMany
  • dialersetting - 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 Setting
  • callerid - CallerID number
  • caller_name - Caller name
  • call_timeout - call timeout
  • survey - Foreign key relationship to the Survey
  • aleg_gateway - Foreign key relationship to the Gateway model. Gateway to use to call the subscriber
  • sms_gateway - Gateway to transport the SMS
  • voicemail - Enable Voicemail Detection
  • amd_behavior - Detection Behaviour

Relationships:

  • user - Foreign key relationship to the a User model. CalendarSetting are assigned to a User
  • voicemail_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.

Alarm

class appointment.models.alarms.Alarm(*args, **kwargs)

This is for Alarms / Reminders on events models.

copy_alarm(new_event, next_occurrence)

Create a copy of the Alarm

retry_alarm()

Task to check if Alarm needs to be respooled after it failed

SMSCampaign

class mod_sms.models.SMSCampaign(*args, **kwargs)

This defines the SMSCampaign

Attributes:

  • campaign_code - Auto-generated campaign code to identify the campaign
  • name - Campaign name
  • description - Description about the Campaign
  • status - Campaign status
  • callerid - Caller ID
  • startingdate - Starting date of the Campaign
  • expirationdate - Expiry date of the Campaign
  • daily_start_time - Start time
  • daily_stop_time - End time
  • week_day_setting (monday, tuesday, wednesday, thursday, friday, saturday, sunday)
  • frequency - Frequency, speed of the campaign. number of calls/min
  • maxretry - Max retry allowed per user
  • intervalretry - Time to wait between retries in seconds
  • sms_gateway - Gateway to transport the SMS
  • extra_data - Additional data to pass to the application

Relationships:

  • content_type - Defines the application (voice_app or survey) to use when the call is established on the A-Leg
  • object_id - Defines the object of content_type application
  • content_object - Used to define the Voice App or the Survey with generic ForeignKey
  • phonebook - 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

is_authorized_contact(str_contact)

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