SlideShare a Scribd company logo
Newfies-Dialer Documentation
                   Release 1.1.0




                 Arezqui Belaid




                      January 16, 2012
Newfies-Dialer : Autodialer software - Documentation version 1.1.0
CONTENTS



1   Getting Started                                                                                                                                                                                 3
    1.1 Introduction . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .                                                                                  3

2 Installation                                                                                                                                                                                       7
  2.1 Installation overview . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .                                                                                    7
  2.2 Broker Installation . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .                                                                                    9
  2.3 Celery Installation . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .                                                                                   11

3 User Guide                                                                                                                                                                                        13
  3.1 Overview . . . . . . . . . .      .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   13
  3.2 How to use Newfies-Dialer .        .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   13
  3.3 Admin Panel . . . . . . . .       .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   23
  3.4 Customer Panel . . . . . . .      .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   35

4 Configuration and Defaults                                                                                                                                                                         49
  4.1 Sample Configuration . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .                                                                                       49
  4.2 Celery Configuration . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .                                                                                     52

5 FreeSwitch Installation and Configuration                                                                                                                                                          55
  5.1 Freeswitch Installation and configuration . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .                                                                                      55
  5.2 Plivo Installation and configuration . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .                                                                                     55
  5.3 Freeswitch Trunk configuration . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .                                                                                       56

6 Developer doc                                                                                                                                                                                     59
  6.1 Prerequisites . . . . . . . . .       .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   59
  6.2 Coding Style & Structure . .          .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   59
  6.3 Objects Description . . . . .         .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   60
  6.4 Database Design . . . . . . .         .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   66
  6.5 Newfies-Dialer Views . . . .           .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   66
  6.6 Newfies-Dialer Admin Views             .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   71
  6.7 Newfies Tasks . . . . . . . .          .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   73
  6.8 Newfies Signals . . . . . . .          .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   74
  6.9 Test Case Descriptions . . . .        .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   74

7 API Reference                                                                                                                                                                                     79
  7.1 CampaignResource . . . . . . . . . .                              .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   79
  7.2 CampaignDeleteCascadeResource                                     .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   83
  7.3 PhonebookResource . . . . . . . . .                               .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   83
  7.4 BulkContactResource . . . . . . . .                               .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   85
  7.5 CampaignSubscriberResource . .                                    .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   85


                                                                                                                                                                                                     i
7.6    CallrequestResource . . .                                 .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .    86
     7.7    CdrResource . . . . . . . . .                             .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .    88
     7.8    AnswercallResource . . . .                                .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .    89
     7.9    HangupcallResource . . . .                                .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .    89
     7.10   SurveyAppResource . . . .                                 .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .    90
     7.11   SurveyQuestionResource                                    .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .    92
     7.12   SurveyResponseResource                                    .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .    94

8    Contributing                                                                                                                                                                                                     97
     8.1 Community Code of Conduct . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .                                                                                                        97
     8.2 Reporting a Bug . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .                                                                                                    98
     8.3 Coding Style . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .                                                                                                   99

9 Frequently Asked Questions                                                                                      101
  9.1 General . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 101
  9.2 Misconceptions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 102

10 Troubleshooting                                                                                                                                                                                                    103
   10.1 Where to find help . . . . . . .                           .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   103
   10.2 Where to find the log files . . .                           .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   103
   10.3 How to run a quick test call . .                          .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   104
   10.4 Run in debug mode . . . . . . .                           .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   104
   10.5 Celerymon . . . . . . . . . . .                           .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   104
   10.6 How to discard all pending tasks                          .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   105
   10.7 Checking Plivo is running . . .                           .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   105
   10.8 Checking Freeswitch . . . . . .                           .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   105
   10.9 Step By Step Checklist . . . . .                          .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   105

11 Resources                                                                                                                                                                                                          107
   11.1 Getting Help      .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   107
   11.2 Bug tracker .     .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   107
   11.3 Wiki . . . .      .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   107
   11.4 Contributing      .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   107
   11.5 License . . .     .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   108

12 Indices and tables                                                                                                                                                                                                 109

Python Module Index                                                                                                                                                                                                   111

Index                                                                                                                                                                                                                 113




ii
Newfies-Dialer Documentation, Release 1.1.0


     Version 1.1
     Release 1.1.0
     Date January 16, 2012
Contents:




CONTENTS                                                             1
Newfies-Dialer Documentation, Release 1.1.0




2                                            CONTENTS
CHAPTER

                                                                                                              ONE



                                                           GETTING STARTED

Contents:


1.1 Introduction

      Web http://www.newfies-dialer.org/
      Download http://www.newfies-dialer.org/download/
      Source https://github.com/Star2Billing/newfies-dialer/
      Keywords dialer, voip, freeswitch, django, asynchronous, rabbitmq, redis, python, distributed
– Newfies is an open source VoIP Dialer based on distributed message passing. It has been built to support cloud
based servers and can also work on standalone servers. It uses Freeswitch (VoIP Server) to outbound calls, but support
for other VoIP Servers such as Asterisk could be easily added in the future. The platform is focused on real-time
operations and task call distributions to clustered brokers and workers.
Newfies-Dialer is written in Python, using the Django Framework. It also operates with message brokers such as
RabbitMQ, Redis but support for Beanstalk, MongoDB, CouchDB and DBMS is also available.
Newfies-Dialer provides an extensive set of APIs to easily integrate with third-party applications.
Using very simple steps, Newfies-Dialer will help you create campaigns, add phonebooks, contacts, build audio mes-
sages and create complex telephony applications. Once your campaigns are ready to start, your messages will be
dispatched and delivered.


     •   Overview
     •   Utility
     •   Features
     •   Architecture
     •   Latest documentation



1.1.1 Overview

Newfies-Dialer can be installed and used by anyone who has a need for mass outbound calling, voice broadcasting or
providing outbound IVR. Some of the potential uses for Newfies-Dialer are listed below.
The system may be installed and used by either companies who wish to make calls on their own behalf, or by SaaS
(Software as a Service) companies that want to provide bulk dialling facilities to their own customers.



                                                                                                                    3
Newfies-Dialer Documentation, Release 1.1.0


1.1.2 Utility

Newfies-Dialer is loaded up with a list of telephone numbers that can be dialled sequentially at very high rates of
calling depending on carrier capacity and hardware, potentially delivering many millions of calls per day.
When the called party answers the call, Newfies-Dialer passes the call to a telephony application that is custom
designed to provide the desired behaviour.
Below are examples of some of the uses for Newfies-Dialer
    • Telecasting: Broadcast marketing or informational messages to customers and clients.
    • Telemarketing: Broadcast a marketing message to potential customers, and give them the option to be put
      through to a call-centre via an IVR (Interactive Voice Response) Menu.
    • Phone Polling, Surveys and Voting: Ring large numbers of people and present IVR options for
      either polling their opinions, interactive surveys, or taking their vote and record the results.
    • Debt Control: Customers can be automatically reminded at intervals that they owe money, and an IVR
      menu presented to talk to the finance department or passed to a credit card capture IVR to pay over the phone.
    • Appointment reminders: Doctors, Dentists, and other organisations that make appointments for their
      clients can integrate Newfies-Dialer into their appointment systems to pass a message reminding them of an
      upcoming appointment.
    • Dissemination of information via phone: Newfies-Dialer was originally designed to call large
      numbers of people and disseminate medical and health advice via the ubiquitous cellphone in 3rd world countries
      where often, literacy levels are low. On a local scale, it can be used to disseminate information about forthcoming
      community events.
    • Mass Emergency broadcast: Where there is a necessity to warn large numbers of people in a short space
      of time, such as weather warnings.
    • Voice Conferencing: Attendees for a voice conference or podcast can be dialled up from a central loca-
      tion, and be connected in an audio conference room.
    • Subscription Reminders and Renewals: Where a company sells an annual subscription for a prod-
      uct or service, Newfies-Dialer can be configured to dial the customer, remind them that the subscription is due,
      and optionally pass the call into a call centre or into a credit card payment IVR.




4                                                                                       Chapter 1. Getting Started
Newfies-Dialer Documentation, Release 1.1.0


1.1.3 Features

      Tele-      Based on leading open source Freeswitch, Asterisk
      phony
      PBX
      Dis-       Runs on one or more machines. Supports broker clustering and HA when used in
      tributed   combination with RabbitMQ. You can set up new workers without central configuration
                 (e.g. use your grandma’s laptop to help if the queue is temporarily congested).
      Concur-    Throttle Concurrent Calls
      rency
      Schedul-   Supports recurring tasks like cron, or specifying an exact date or countdown for when the
      ing        task should be executed. Can re-try to the non connected numbers at a later time
      IVR        Accommodates multiple IVR scripts with options to connect the user to some other
      support    IVR/phone number on pressing a key
      Web In-    Newfies can be managed via a Web interface. Realtime web-based reports for call details
      terface    and current calls. You can query status and results via URLs, enabling the ability to poll
                 task status using Ajax.
      Error      Can be configured to send emails to the administrator if a tasks fails.
      Emails
      Import     Import contact details from a .csv file
      Contact


1.1.4 Architecture




   • User selects contacts, phonebooks and campaigns, then chooses a voice application to use. The campaign is
     then launched
   • Newfies-Dialer spools the outbound calls to FreeSWITCH via Plivo.
   • Plivo sends the dial request to FreeSWITCH using the event socket.
   • FreeSWITCH dials the contact via the configured telephony gateways.
   • Contact picks up the call, and the answer event is received in FreeSWITCH and passed back to Plivo.
   • Newfies-Dialer is notified that the call is answered, then renders & relays RestXML to Plivo.
   • Plivo interprets RestXML and sends the application call-flow commands to FreeSWITCH.
   • The voice application is delivered to the contact by FreeSWITCH.


1.1. Introduction                                                                                             5
Newfies-Dialer Documentation, Release 1.1.0


1.1.5 Latest documentation

The latest documentation with user guides, tutorials and API reference is hosted at “Readthedocs”.




6                                                                                   Chapter 1. Getting Started
CHAPTER

                                                                                                              TWO



                                                                          INSTALLATION

Contents:


2.1 Installation overview

2.1.1 Install requirements

A Requirements file gives you a way to create an environment where you can put all optional dependencies which are
needed for your Project/Application.
To get started with Newfies-Dialer you must have the following installed:
    • python >= 2.4 (programming language)
    • Apache / http server with WSGI modules
    • Django Framework >= 1.3 (Python based Web framework)
    • Celery >= 2.2 (Asynchronous task queue/job queue based on distributed message passing)
    • MySQL-python >= 1.2.3 (MySQL for python language)
    • Werkzeug >= 0.6.2 (Collection of various utilities for WSGI applications)
    • amqplib >= 0.6.1 (Client library for AMQP)
    • anyjson >= 0.3 (Loads the fastest JSON module)
    • django-celery >= 2.2.4 (Celery integration for Django)
    • django-extensions >= 0.6 (Collection of global custom management extensions for Django)
    • django-jsonfield >= 0.6 (Reusable django field that can use inside models)
    • django-pagination >= 1.0.7 (Utilities for creating robust pagination tools throughout a django application)
    • django-picklefield >= 0.1.9 (Implementation of a pickled object field)
    • django-threaded-multihost >= 1.4-0 (Provides multi-host utilities to Django projects)
    • django-urlauth = 0.1.1 (Allows to build links with authentication effect )
    • django-uuidfield >= 0.2 (Provides a UUIDField for your Django models)
    • django-reusableapps >= 0.1.1 (Python module to enable Django to load reusable, pluggable and egg-based
      applications)
    • docutils >= 0.7 (Text processing system for processing plaintext documentation into useful formats)



                                                                                                                    7
Newfies-Dialer Documentation, Release 1.1.0


    • importlib >= 1.0.2 (Implementation of the import statement)
    • kombu >= 1.0.2 (An AMQP - Advanced Message Queuing Protocol messaging framework for Python)
    • pyparsing >= 1.5.5 (A general parsing module for Python)
    • python-dateutil >= 1.5 (Extensions to the standard datetime module)
    • redis >= 2.2.2 (Redis Python Client)
    • simplejson >= 2.1.3 (Simple, fast, complete, correct and extensible JSON)
    • uuid >= 1.30 (UUID object and generation functions )
    • wsgiref >= 0.1.2 (Validation support for WSGI )
    • switch2bill-common (Common library that are reused by Star2Billing)
    • simu-prefix-country (Provide Prefix and Country information)
    • django-tastypie (Creating delicious APIs for Django)
    • BeautifulSoup >= 3.2.0 (HTML parser optimized for screen-scraping)
    • Pygments >= 1.4 (A generic syntax highlighter)
    • django-admin-tools (Collection of tools for the django administration)
    • python-memcached >= 1.47 (Python based API for communicating with the memcached distributed memory
      object cache daemon)
    • django-memcache-status >= 1.0.1 (Displays statistics about memcached instances)
    • django-notification >= 0.1.3 (User notification management for the Django web framework)
    • identicon (identicon python implementation)
    • django-sentry >= 1.8.6.2 (Real-time logging / error tracing for Django)
    • django-qsstats >= 0.3.1 (A django microframework that eases the generation of aggregate data for querysets)
Use PIP to install all the requirements,:
$ pip install -r requirements.txt



2.1.2 Installation Script

You can install Newfies-Dialer manually or using the shell script provided.
To install Newfies-Dialer using the script,:
$ chmod +x install/install-newfies.sh

$ ./install/install-newfies.sh

$ chmod +x install/install-celery.sh

$ ./install/install-celery.sh



2.1.3 Running a Newfies-Dialer

Inside Newfies-Dialer directory you should run:




8                                                                                       Chapter 2. Installation
Newfies-Dialer Documentation, Release 1.1.0



$ mkdir database

$ python manage.py syncdb

$ python manage.py collectstatic

$ python manage.py runserver

syncdb will create a database named test.db in database folder of the Newfies-Dialer directory. We have con-
figured Newfies-Dialer to do this, but you can change this simply by modifying settings.py where DATABASES
dictionary is constructed. You can find more information about this in the Django documentation.
collectstatic will fetch all necessary media files and put them into static folder defined in the settings
module.
runserver runs an embedded webserver to test your site. By default it will run on http://localhost:8000. This is
configurable and more information can be found on runserver in Django documentation.


2.1.4 Caching System

When a User requests a page, the Web server makes calculations for business logic and to create the page that your
visitor sees. It creates a processing overhead higher than a standard read-a-file-off-the-filesystem server arrangement.
This is where caching comes in.
To cache something is to save the result of an expensive calculation so that you don’t have to perform the calculation
next time.
$ mkdir /usr/share/django_cache



2.2 Broker Installation

This document describes the installation of two different Brokers. One is Redis and second is Rabbitmq. You can
install either to work with Newfies-Dialer.


2.2.1 Redis

Download Source

Download : redis-server_2.0.0~rc2-1_amd64.deb.


To install Redis-Server

$ sudo dpkg -i redis-server_2.0.0~rc2-1_amd64.deb

or you can use apt-get
$ apt-get install redis-server




2.2. Broker Installation                                                                                            9
Newfies-Dialer Documentation, Release 1.1.0


Running Server

$ redis-server



2.2.2 Rabbitmq

RabbitMQ is a complex and sophisticated product. If you don’t need this level of robustness, then you might want to
take a look at Redis - it installs easily, runs relatively lean, and can be monitored and maintained without a lot of fuss.
See Installing RabbitMQ over at RabbitMQ’s website.

Note: If you’re getting nodedown errors after installing and using rabbitmqctl then this blog post can help you
identify the source of the problem:
        http://somic.org/2009/02/19/on-rabbitmqctl-and-badrpcnodedown/



Download Source

http://www.rabbitmq.com/server.html


Debian APT repository

To make use of the RabbitMQ APT repository,
1. Add the following line to your /etc/apt/sources.list
deb http://www.rabbitmq.com/debian/ testing main


Note: The word testing in the above line refers to the state of the release of RabbitMQ, not any particular Debian
distribution. You can use it with Debian stable, testing or unstable, as well as with Ubuntu. In the future there will be
a stable release of RabbitMQ in the repository.

     2. (optional) To avoid warnings about unsigned packages, add RabbitMQ’s public key to your trusted key list using
        apt-key(8)
$ wget http://www.rabbitmq.com/rabbitmq-signing-key-public.asc

$ sudo apt-key add rabbitmq-signing-key-public.asc

     3. Run apt-get update.
4. Install packages as usual; for instance,
$ sudo apt-get install rabbitmq-server



Setting up RabbitMQ

To use celery we need to create a RabbitMQ user, a virtual host and allow that user access to that virtual host:




10                                                                                            Chapter 2. Installation
Newfies-Dialer Documentation, Release 1.1.0



$ rabbitmqctl add_user myuser mypassword

$ rabbitmqctl add_vhost myvhost

$ rabbitmqctl set_permissions -p myvhost myuser ".*" ".*" ".*"

See the RabbitMQ Admin Guide for more information about access control.


Starting/Stopping the RabbitMQ server

To start the server:
$ sudo rabbitmq-server

you can also run it in the background by adding the -detached option (note: only one dash):
$ sudo rabbitmq-server -detached

Never use kill to stop the RabbitMQ server, but rather use the rabbitmqctl command:
$ sudo rabbitmqctl stop

When the server is running, you can continue reading Setting up RabbitMQ.


2.3 Celery Installation

2.3.1 Celery

Celery is an asynchronous task queue/job queue based on distributed message passing. It is focused on real-time
operation, but supports scheduling as well.
You can install Celery either via the Python Package Index (PyPI) or from source.


To install using pip

$ pip install Celery



To install using easy_install

$ easy_install Celery



Downloading and installing from source

To Download the latest version click here.
You can install it by doing the following:
$ tar xvfz celery-0.0.0.tar.gz

$ cd celery-0.0.0

$ python setup.py build


2.3. Celery Installation                                                                                    11
Newfies-Dialer Documentation, Release 1.1.0



$ python setup.py install # as root



Using the development version

You can clone the repository by doing the following:
$ git clone git://github.com/ask/celery.git




12                                                     Chapter 2. Installation
CHAPTER

                                                                                                          THREE



                                                                               USER GUIDE

Contents:


3.1 Overview

Newfies-Dialer is an open source VoIP Dialer based on distributed message passing. It has been built to support cloud
servers and also works on standalone servers. It uses Freeswitch (VoIP Server) to outbound calls, but support for other
VoIP Servers such as Asterisk could be easily added in the future. The platform is focused on real-time operations and
task call distributions to clustered brokers and workers.
Newfies-Dialer is a computerised system that automatically dials a group of telephone numbers for connection to
assigned campaigns.
Features:
*   Restful-API based to easily integrate the platform dialer with third-party applications
*   Web-based administrative/customer interfaces
*   Lower operating costs
*   Calls are made through Internet VoIP. No need for telephony hardware
*   Call reports and Statistics



3.2 How to use Newfies-Dialer

3.2.1 Freeswitch Set-Up

Configure        trunks     and      gateways       in    Freeswitch  by     creating  an     XML      file    in
/usr/local/freeswitch/conf/sip_profiles/external/ and give it an identifiable name, e.g. call-labs.xml, and place
the following lines in the file, edited to suit your provider:
<include>
<gateway name="ip address or hostname of carrier">
<!--/// account username *required* ///-->
<param name="username" value="your username provided by carrier"/>
<!--/// auth realm: *optional* same as gateway name, if blank ///-->
<!--<param name="realm" value="asterlink.com"/>-->
<!--/// username to use in from: *optional* same as username, if blank ///-->
<param name="from-user" value="your username provided by carrier"/>
<!--/// domain to use in from: *optional* same as realm, if blank ///-->
<!--param name="from-domain" value=""/-->
<!--/// account password *required* ///-->



                                                                                                                    13
Newfies-Dialer Documentation, Release 1.1.0



<param name="password" value="your password supplied by carrier"/>
<!--/// extension for inbound calls: *optional* same as username, if blank ///-->
<!--<param name="extension" value="cluecon"/>-->
<!--/// proxy host: *optional* same as realm, if blank ///-->
<!--<param name="proxy" value="asterlink.com"/>-->
<!--/// send register to this proxy: *optional* same as proxy, if blank ///-->
<!--<param name="register-proxy" value="mysbc.com"/>-->
<!--/// expire in seconds: *optional* 3600, if blank ///-->
<!--<param name="expire-seconds" value="60"/>-->
<!--/// do not register ///-->
<param name="register" value="true"/>
<!-- which transport to use for register -->
<!--<param name="register-transport" value="udp"/>-->
<!--How many seconds before a retry when a failure or timeout occurs -->
<!--<param name="retry-seconds" value="30"/>-->
<!--Use the callerid of an inbound call in the from field on outbound calls via this gateway -->
<!--<param name="caller-id-in-from" value="false"/>-->
<!--extra sip params to send in the contact-->
<!--<param name="contact-params" value="tport=tcp"/>-->
<!--send an options ping every x seconds, failure will unregister and/or mark it down-->
<!--<param name="ping" value="25"/>-->
</gateway>
</include>

Then in the Freeswitch CLI (fs_cli) “sofia profile external restart reloadxml”. When the command is complete, check
the gateway has registered with the command “sofia status”.


3.2.2 Create Gateway

Having created the gateway in Freeswitch, Newfies-Dialer has to be told that it can use it. In admin, add a new dialer
gateway, e.g. sofia/gateway/myprovider/ (The final / is important) where “myprovider” is the gateway name setting
used in above xml file in Freeswitch.
Only the fields in bold are compulsory.


3.2.3 Dialer Settings

Dialer settings are mapped with system users who are going to create campaigns & contacts. If dialer settings are not
mapped to users, notifications & emails are sent to super admin user.
To create restrictions (like the Max. no of campaign, Max no of contacts etc.) for system User, Click on Add dialer
settings. Add numeric values for the limit.
To apply the dialer settings limit on a system user, click on Customers or Admins in admin UI, select the user to
update, & apply the settings from the dialer settings list.


3.2.4 Create Voice Application

A number of voice applications are provided with Newfies-Dialer. Click Add Voice App give the voice application
a name, select the type of application from the dropdown, select the gateway to use if the call is to be redirected, and
provide the data to be used, e.g. in the case of “Speak” this would be the words to convert to text to speech.




14                                                                                          Chapter 3. User Guide
Newfies-Dialer Documentation, Release 1.1.0


3.2.5 Create Survey




The survey application for Newfies-Dialer allows polls and surveys to be taken over the phone.
Each contact is called, and then played a sound file. After the sound file is heard, the user can enter their answer
through the phone keypad using keys 0 to 9.
Therefore before creating the survey, the first job is to upload the audio for the survey. One audio file is required for
each question.
Uploading Audio Files:
Select Audio Files from the top menu then click add.
Enter a name to describe the audio, then click chose file, select the file you require from your computer, then click
submit.
Note that only mp3, Wav and ogg formats are supported.
The audio file will then be uploaded and renamed so that it is unique.
Create the Survey:
URL:
    • http://localhost:8000/survey/
    • http://localhost:8000/survey/add/
    • http://localhost:8000/survey/1/




3.2. How to use Newfies-Dialer                                                                                       15
Newfies-Dialer Documentation, Release 1.1.0




Select Modules from the top menu, then Survey.
Click the add button, then give the survey a name and description, then click Submit.
A button will now appear to add a question.
In the question field, put in some text to describe the question - e.g “What is 1+1”; select the audio file pertaining to
the question which was uploaded in the previous step.
If no audio file is selected, then the system will automatically play the text in the question field using the text to speech
engine.
Then click Add Response. A further two fields will appear named Key Digit and Key Value. In key Digit put a number
from 0 to 9 which should be pressed for this answer. In the example “What is 1+1”, “2” should be placed in the Key
Digit Field”
The Key Value field is used in the survey reports, and so in this case, you would put “Correct” as 1+1=2. You may
chose to add responses 0,1 and 3 to 9 as key digits, with key values of “Wrong” as these answers will then be summed
up in the Survey Reports.
You can then go on to add another question, and its associated responses. On completion, click Update Survey.
To use the Survey in a campaign, simply create a campaign as normal, and select the Survey name in the Application
drop-down.


3.2.6 Create call list

To create a call list, click on Add in Phonebook list, add name of phonebook & its description. Click on Contacts
and add phone numbers in the contact list. You can also import your call list from csv files, via clicking on Import
contact.
Update Phonebook:




16                                                                                            Chapter 3. User Guide
Newfies-Dialer Documentation, Release 1.1.0




Contact List:




Import contact:


3.2. How to use Newfies-Dialer                                          17
Newfies-Dialer Documentation, Release 1.1.0




3.2.7 Create campaign

To create a campaign, click on Add in campaign list, add details for the campaign. Important: Add the campaign’s
start and end dates with times & week-day exceptions. Select the gateway through which calls will be routed & the
phonebook(s) linked with the contacts.
Campaign list:




18                                                                                    Chapter 3. User Guide
Newfies-Dialer Documentation, Release 1.1.0




Update Campaign: .. image:: ../_static/images/customer/update_campaign.png
Update Campaign: .. image:: ../_static/images/customer/update_campaign_part2.png


3.2.8 Dialer Settings

Dialer settings has to be mapped with system users who are going to create campaigns & contacts. If dialer setting is
not mapped with system users, notification & mail has been sent to Super admin user.
To create restrictions (like the Max. no of campaign, Max no of contacts etc.) for system User, Click on Add in dialer
settings list of admin side. Add numeric values for the limit.
To apply the dialer settings limit on a system user, click on Customers or Admins in admin UI, select the user to
update, & apply the settings from the dialer settings list.
Dialer settings:




Update dialer settings:




3.2. How to use Newfies-Dialer                                                                                      19
Newfies-Dialer Documentation, Release 1.1.0




3.2.9 Call contacts/subscribers

A call-request will spool a call directly from the platform using a dialer gateway and update the call-request status
after receiving a response from the gateway.




20                                                                                       Chapter 3. User Guide
Newfies-Dialer Documentation, Release 1.1.0




3.2.10 VoIP Call Report

As per the status of a call-request, it will be stored in the VoIP call records. This gives information of all the calls &
call statistics made with the call-request and also you can search for records on the basis of date range. You can export
the VoIP call report into a csv file.




3.2. How to use Newfies-Dialer                                                                                          21
Newfies-Dialer Documentation, Release 1.1.0




22                                           Chapter 3. User Guide
Newfies-Dialer Documentation, Release 1.1.0


3.2.11 Survey Report




When the survey is complete, the survey results can be inspected by clicking Reporting on the top and selecting Survey
Results from the drop-down.


3.2.12 Settings

The settings page provides a number of functions:
    • Account - Change the detail of the account.
    • Password - Change the password.
    • Notifications - Display system notifications.
    • Limitation - Displays the parameters of the dialer settings.
    • Authorized - Facitiy to check that a number is not blacklisted.


3.3 Admin Panel

http://localhost:8000/admin/
This interface provides user (ACL) management, full control of all Campaigns, Phonebooks, Subscribers, Gateways
and configuration of the Audio Application.


     • Screenshot with Features




3.3. Admin Panel                                                                                                   23
Newfies-Dialer Documentation, Release 1.1.0


3.3.1 Screenshot with Features

Dashboard

Dashboard page for the admin interface after successful login with superuser credentials




Admin

The Admin section allows you to create administrators who have access the admin screens. Levels of access can be set.
If the administrator is to be allowed to make calls, then a gateway and dialer- settings must be set for that administrator.


Customers

Customers only have access to the customer panel. Before a customer can make calls, they must have both dialer-
settings and a gateway attached to their account.


Sites

Some of the features of Newfies-Dialer are dependent on the hostname or IP address, so this has to be set correctly in
site address.
In the Admin dashboard, locate the “Sites” link and click change. By default, there will be an entry of “exam-
ple.com”. Edit this setting to reflect the hostname of the server, or if you do not have this set up, the IP address. e.g.
http://www.domain.tld:8008 or in the case of an IP address, http://192.168.1.200:8008
     • http://localhost:8000/admin/sites/




24                                                                                             Chapter 3. User Guide
Newfies-Dialer Documentation, Release 1.1.0


Phonebook

The phonebook list will be displayed from the following URL. You can add a new phonebook by clicking Add
phonebook and adding the name of the phonebook and its description, Also from the phonebook list, click on the
phonebook that you want to update.
URL:
    • http://localhost:8000/admin/dialer_campaign/phonebook/




To Add/Update phonebook for a user
URL:
    • http://localhost:8000/admin/dialer_campaign/phonebook/add/
    • http://localhost:8000/admin/dialer_campaign/phonebook/1/




Contact

The contact list will be displayed from the following URL and you can add a new contact by clicking Add contact
& adding the contact details (i.e. phone number, name, description about contact, contact status) to one phonebook
from the phonebook list.
If the contact is active and the linked phonebook is also attached to a running campaign, then the contact will be added
into campaign subscribers.
From the contact list, click on the contact that you want to update.
URL:
    • http://localhost:8000/admin/dialer_campaign/contact/



3.3. Admin Panel                                                                                                     25
Newfies-Dialer Documentation, Release 1.1.0




To Add/Update a contact
URL:
     • http://localhost:8000/admin/dialer_campaign/contact/add/
     • http://localhost:8000/admin/dialer_campaign/contact/1/




To import bulk contacts into a phonebook, click on Import contacts. where you can upload the contacts via a
CSV file in to one phonebook.
URL:
     • http://localhost:8000/admin/dialer_campaign/contact/import_contact/




26                                                                                Chapter 3. User Guide
Newfies-Dialer Documentation, Release 1.1.0




Campaign

The campaign list will be displayed from the following URL. You can add a new campaign by clicking Add
campaign. While adding a campaign, it is important to add campaign’s start and end dates with time & week-day
exceptions. Also select the gateway through which calls will be routed & the phonebook(s) linked with contacts.
From the campaign list, click on the campaign that you want to update.
URL:
    • http://localhost:8000/admin/dialer_campaign/campaign/




To Add/Update Campaign for user
URL:
    • http://localhost:8000/admin/dialer_campaign/campaign/add/
    • http://localhost:8000/admin/dialer_campaign/campaign/1/




3.3. Admin Panel                                                                                            27
Newfies-Dialer Documentation, Release 1.1.0




Campaign Subscriber

The Campaign Subscriber list will be displayed from the following URL. You can add a new campaign subscriber by
clicking Add Campaign Subscriber. Also from the campaign subscriber list, click on the subscriber to update.
While creating a contact, if its linked phonebook is also attached to a running campaign, then the contact will be added
into the campaign subscriber.
URL:
     • http://localhost:8000/admin/dialer_campaign/campaignsubscriber/




To Add/Update Campaign Subscriber
URL:
     • http://localhost:8000/admin/dialer_campaign/campaignsubscriber/add/
     • http://localhost:8000/admin/dialer_campaign/campaignsubscriber/1/




28                                                                                          Chapter 3. User Guide
Newfies-Dialer Documentation, Release 1.1.0




Dialer Settings

The dialer settings list will be displayed from the following URL. The Dialer settings list is applied to a system User.
You can add a new setting by clicking Add Dialer Settings and add numeric values for the limit. Also from
the dialer settings list, click on the setting to update.
URL:
    • http://localhost:8000/admin/dialer_settings/dialersetting/




To Add/Update dialer settings for a Newfies-Dialer user
URL:
    • http://localhost:8000/admin/dialer_settings/dialersetting/add/
    • http://localhost:8000/admin/dialer_settings/dialersetting/1/




3.3. Admin Panel                                                                                                     29
Newfies-Dialer Documentation, Release 1.1.0




To apply dialer settings limit to a User, click on Customers or Admins, select the user to be updated & apply
settings from the dialer settings list.
URL:
     • http://localhost:8000/admin/auth/staff/1/




Dialer Gateway

The Dialer Gateway list will be displayed from the following URL. You can add a new gateway by clicking Add
Dialer Gateway and adding the details (e.g. gateway name, hostname, protocol etc.). Also from the gateway list,
click on the gateway that you want to update.
URL:
     • http://localhost:8000/admin/dialer_gateway/gateway/




30                                                                                   Chapter 3. User Guide
Newfies-Dialer Documentation, Release 1.1.0




To Add/Update a dialer gateway
URL:
    • http://localhost:8000/admin/dialer_gateway/gateway/add/
    • http://localhost:8000/admin/dialer_gateway/gateway/1/




Voice Application

The Voice application list will be displayed from the following URL. You can add a new application by clicking Add
Voice Application. Also from the application list, click on the application to update.
URL:
    • http://localhost:8000/admin/voice_app/voiceapp/




To Add/Update a Voice application
URL:
    • http://localhost:8000/admin/voice_app/voiceapp/add/


3.3. Admin Panel                                                                                               31
Newfies-Dialer Documentation, Release 1.1.0


     • http://localhost:8000/admin/voice_app/voiceapp/1/




Survey

The survey application for Newfies-Dialer allows polls and surveys to be taken over the phone.
Each contact is called, and then played a sound file. After the sound file is heard, the user can enter their answer
through the phone keypad using keys 0 to 9.
Therefore before creating the survey, the first job is to upload the audio for the survey. One audio file is required for
each question.
       Add Audio File
CLick Audio Files, then click Add.
Give the audio file a descriptive name, chose the file to upload.
In the Admin screens, there are options to convert to other formats, change the number of channels, e.g. change from
stereo to mono, and down-sample the frequency. Finally, the user can be assigned.
       Survey Admin Functions
From the admin screen, Surveys can be added, deleted and edited. Additionally, survey questions can be re-ordered.
URL:
     • http://localhost:8000/admin/survey/surveyapp/




To Add/Update a survey
URL:
     • http://localhost:8000/admin/survey/surveyapp/add/
     • http://localhost:8000/admin/survey/surveyapp/1/


32                                                                                         Chapter 3. User Guide
Newfies-Dialer Documentation, Release 1.1.0




To Add/Update a survey question
    • http://localhost:8000/admin/survey/surveyquestion/add/
    • http://localhost:8000/admin/survey/surveyquestion/1/




When the survey is complete, the results can be inspected.
    • http://localhost:8000/admin/survey/surveycampaignresult/


Call Request

The call request list will be displayed from the following URL. You can add a new call request by clicking Add Call
Request. Also from the call request list, click on the request to update.
URL:
    • http://localhost:8000/admin/dialer_cdr/callrequest/




3.3. Admin Panel                                                                                                33
Newfies-Dialer Documentation, Release 1.1.0




To Add/Update a Call Request
URL:
     • http://localhost:8000/admin/dialer_cdr/callrequest/add/
     • http://localhost:8000/admin/dialer_cdr/callrequest/1/




VoIP Call Report

A VoIP Call list will be displayed from following URL. You can not add new call reports.
URL:
     • http://localhost:8000/admin/dialer_cdr/voipcall/



34                                                                                         Chapter 3. User Guide
Newfies-Dialer Documentation, Release 1.1.0




3.4 Customer Panel

User Interface :
http://localhost:8000/ This application provides a user interface for restricted management of the User’s Campaigns,
Phonebooks and Subscribers. It also provides detailed reporting of calls and message delivery.


     • Screenshot with Features



3.4.1 Screenshot with Features

Index

Index page for the customer interface after successful login with user credentials




3.4. Customer Panel                                                                                              35
Newfies-Dialer Documentation, Release 1.1.0




Phonebook

The phonebook list will be displayed from the following URL. You can add a new phonebook by clicking Add
phonebook and add the name of a phonebook and its description. Also from the phonebook list, click on the
phonebook to update.
URL:
     • http://localhost:8000/dialer_campaign/phonebook/




36                                                                              Chapter 3. User Guide
Newfies-Dialer Documentation, Release 1.1.0




To Add/Update a Phonebook for a logged in user
URL:
   • http://localhost:8000/dialer_campaign/phonebook/add/
   • http://localhost:8000/dialer_campaign/phonebook/1/




3.4. Customer Panel                                                                                37
Newfies-Dialer Documentation, Release 1.1.0


Contact

The contact list will be displayed from following the URL. You can add a new contact by clicking Add contact
& adding the contact details (i.e. phone number, name, description about contact, contact status) under the logged in
user’s phonebook from the phonebook list. On the contact list, click on the contact to update.
URL:
     • http://localhost:8000/dialer_campaign/contact/




To Add/Update a contact in a phonebook
URL:
     • http://localhost:8000/dialer_campaign/contact/add/
     • http://localhost:8000/dialer_campaign/contact/1/




38                                                                                       Chapter 3. User Guide
Newfies-Dialer Documentation, Release 1.1.0




To import bulk contacts into a phonebook, click on Import. where you can upload contacts via a CSV file under a
logged in user’s phonebook.
URL:
   • http://localhost:8000/dialer_campaign/contact/import/




3.4. Customer Panel                                                                                        39
Newfies-Dialer Documentation, Release 1.1.0




Voice Application


A number of voice applications are provided with Newfies-Dialer. Click Add Voice App give the voice application
a name, select the type of application from the dropdown, select the gateway to use if the call is to be redirected, and
provide the data to be used, e.g. in the case of “Speak” this would be the words to convert to text to speech.
URL:
     • http://localhost:8000/voiceapp/




40                                                                                          Chapter 3. User Guide
Newfies-Dialer Documentation, Release 1.1.0




To Add/Update a contact in a voice app
URL:
    • http://localhost:8000/voiceapp/add/
    • http://localhost:8000/voiceapp/1/




A Number of voice applications currently supported are:-


3.4. Customer Panel                                                                               41
Newfies-Dialer Documentation, Release 1.1.0


Dial:
The dial command allows the call to be redirected another destination. In this case, Select the B-Leg as the trunk to be
used for the redirected call.
Conference:
Direct the contact into a conference which has previously been defined in Freeswitch. In the Data field, put the name
or extension number.
PlayAudio:
PlayAudio plays a sound file that has previously been uploaded to the system.
The Audio is uploaded via the Audio Files menu on the top menu. Click add, then select the file on your computer to
be uploaded. The file will be renamed with a unique name. It can be played via the web browser.
In the data field in the voice application, either put the full file path to the sound file.              Typically this is
/usr/share/newfies/usermedia/upload/audiofiles/audio-file-XXXX-12345678.mp3
However where there are multiple Freeswitch nodes and workers, the sound file can uploaded to Newfies-Dialer, and
the Web URL placed in the Data field. Typically, this will be
     • http://domain.tld:8008/mediafiles/upload/audiofiles/-XXXX-12345678.mp3
This allows other Freeswitch nodes to download and play the audio file on demand without having to upload it to each
node.
Speak:
This will call a contact, and then using the text to speech engine, which is Flite as standard, play the audio in the Data
field.
Survey: A survey and polling application which is described in more detail in a subsequent section.


Survey


The survey application for Newfies-Dialer allows polls and surveys to be taken over the phone.
Each contact is called, and then played a sound file. After the sound file is heard, the user can enter their answer
through the phone keypad using keys 0 to 9.
Therefore before creating the survey, the first job is to upload the audio for the survey. One audio file is required for
each question.
Uploading Audio Files:
Select Audio Files from the top menu then click add.
Enter a name to describe the audio, then click chose file, select the file you require from your computer, then click
submit.
Note that only mp3, Wav and ogg formats are supported.
The audio file will then be uploaded and renamed so that it is unique.
Create the Survey:
URL:
     • http://localhost:8000/survey/
     • http://localhost:8000/survey/add/
     • http://localhost:8000/survey/1/



42                                                                                           Chapter 3. User Guide
Newfies-Dialer Documentation, Release 1.1.0




Select Modules from the top menu, then Survey.
Click the add button, then give the survey a name and description, then click Submit.
A button will now appear to add a question.
In the question field, put in some text to describe the question - e.g “What is 1+1”; select the audio file pertaining to
the question which was uploaded in the previous step.
If no audio file is selected, then the system will automatically play the text in the question field using the text to speech
engine.
Then click Add Response. A further two fields will appear named Key Digit and Key Value. In key Digit put a number
from 0 to 9 which should be pressed for this answer. In the example “What is 1+1”, “2” should be placed in the Key
Digit Field”
The Key Value field is used in the survey reports, and so in this case, you would put “Correct” as 1+1=2. You may
chose to add responses 0,1 and 3 to 9 as key digits, with key values of “Wrong” as these answers will then be summed
up in the Survey Reports.
You can then go on to add another question, and its associated responses. On completion, click Update Survey.
To use the Survey in a campaign, simply create a campaign as normal, and select the Survey name in the Application
drop-down.
Survey Results
When the survey is complete, the survey results can be inspected by clicking Reporting on the top and selecting Survey
Results from the drop-down.


Campaign

The campaign list will be displayed from the following URL. You can add a new campaign for the logged in user by
clicking Add campaign. When adding a campaign, it is important to add the campaign’s start and end dates with



3.4. Customer Panel                                                                                                     43
Newfies-Dialer Documentation, Release 1.1.0


time & week-day exceptions. Select the gateway through which calls will be routed & phonebook(s) that are linked
with contacts from the campaign list, click on campaign to update.
URL:
     • http://localhost:8000/dialer_campaign/campaign/




To Add/Update a Campaign for a logged in user
URL:
     • http://localhost:8000/dialer_campaign/campaign/add/
     • http://localhost:8000/dialer_campaign/campaign/1/




44                                                                                    Chapter 3. User Guide
Newfies-Dialer Documentation, Release 1.1.0




3.4. Customer Panel                                          45
Newfies-Dialer Documentation, Release 1.1.0




Dashboard

Dashboard gives the information anbout campaign & its related call records




46                                                                           Chapter 3. User Guide
Newfies-Dialer Documentation, Release 1.1.0




3.4. Customer Panel                                          47
Newfies-Dialer Documentation, Release 1.1.0




48                                           Chapter 3. User Guide
CHAPTER

                                                                                                              FOUR



                 CONFIGURATION AND DEFAULTS

Contents:


4.1 Sample Configuration

This is a sample configuration to get you started. It should contain all you need to create a basic set-up.


4.1.1 The Configuration Module

Some of the more important parts of the configuration module for the Newfies, settings.py, are explained below:
import os.path
APPLICATION_DIR = os.path.dirname(globals()[’__file__’])

APPLICATION_DIR now contains the full path of your project folder and can be used elsewhere in the
settings.py module so that your project may be moved around the system without you having to worry about
changing any troublesome hard-coded paths.
DEBUG = True

turns on debug mode allowing the browser user to see project settings and temporary variables.
ADMINS = ( (’xyz’, ’xyz@abc.com’) )

sends all errors from the production server to the admin’s email address.
DATABASE_ENGINE = ’mysql’
DATABASE_NAME = ’db-name’
DATABASE_USER = ’user’
DATABASE_PASSWORD = ’password’
DATABASE_HOST = ’mysql-host’
DATABASE_PORT = ’’

sets up the options required for Django to connect to your database.
MEDIA_ROOT = os.path.join(APPLICATION_DIR, ’static’)

tells Django where to find your media files such as images that the HTML templates might use.
ROOT_URLCONF = ’urls’

tells Django to start finding URL matches at in the urls.py module in the newfies project folder.



                                                                                                                  49
Newfies-Dialer Documentation, Release 1.1.0



TEMPLATE_DIRS = ( os.path.join(APPLICATION_DIR, ’templates’), )

tells Django where to find your HTML template files.
  INSTALLED_APPS = (
’django.contrib.auth’,
’django.contrib.contenttypes’,
’django.contrib.sessions’,
’django.contrib.sites’,
’django.contrib.admin’,
...
’dialer_gateway’,
’dialer_campaign’,
’dialer_cdr’,
’dialer_settings’,
’user_profile’,
’voip_server’,
’voip_app’,
...
)

tells Django which applications (custom and external) to use in your project. The custom applications,
dialer_gateway, dialer_campaign etc. are stored in the project folder along with these custom applica-
tions.


4.1.2 The URLs modules

The defined URL patterns for the CPI Pilot project are divided into URL patterns specific to the project and URL
patterns specific to the applications. For more information on how the pattern matching syntax work or how to write
your own url patterns please consult Django’s URL Dispatcher documentation.


Project specific URL patterns

The URL patterns specific to the project are applied in the urls.py file that is stored in the project directory
newfies. The code segments that add these URL patterns aren’t lengthy and are shown below:
urlpatterns = patterns(’’,
  # redirect
  (’^$’, ’django.views.generic.simple.redirect_to’, {’url’: ’/dialer_campaign/’}),
  (r’^admin/’, include(admin.site.urls)),
  (r’^api/dialer_campaign/’, include(’dialer_campaign.api.urls’)),
  (r’^dialer_campaign/’, include(’dialer_campaign.urls’)),
  (r’^static/(?P<path>.*)$’, ’django.views.static.serve’,
      {’document_root’: settings.STATIC_ROOT}),
)



Application specific URL patterns

The URL patterns specific to the dialer_campaign application are applied in the /dialer_campaign/urls.py
file in the dialer_campaign application folder. The code segment that adds these URL patterns isn’t lengthy either and
is shown below:
urlpatterns = patterns(’dialer_campaign.views’,
  (r’^phonebook/$’, ’phonebook_list’),
  (r’^phonebook/add/$’, ’phonebook_add’),


50                                                                     Chapter 4. Configuration and Defaults
Newfies-Dialer Documentation, Release 1.1.0



    (r’^phonebook/(.+)/$’, ’phonebook_change’),
)



4.1.3 The Views module

The functions defined in views.py represent the logic behind the webpages. The view functions (called through
the URL matching) decide which data structures need to be constructed and sent through to the HTML templates. To
do this, each view function uses Django’s object relational model (ORM) to query the database picking out what is
needed for any particular page.
@login_required
def phonebook_add(request):
    """
    Add new Phonebook
    """
    form = PhonebookForm()
    if request.method == ’POST’:
         form = PhonebookForm(request.POST)
         if form.is_valid():
             obj = form.save(commit=False)
             obj.user = User.objects.get(username=request.user)
             obj.save()
             request.session["msg"] = _(’"%s" is added.’ %
             request.POST[’name’])
             return HttpResponseRedirect(’/dialer_campaign/phonebook/’)
    template = ’dialer_campaign/phonebook/change.html’
    data = {
        ’form’: form,
        ’action’: ’add’,
    }
    return render_to_response(template, data,
            context_instance=RequestContext(request))



4.1.4 The Admin Module

The classes defined in admin.py tell Django what attributes are visible and modifiable from the admin site.
Code for naming convention (e.g. Voip -> VoIP) (in admin.py)
Example:
def get_urls(self):
    urls = super(VoipAppAdmin, self).get_urls()
    my_urls = patterns(’’,
        (r’^add/$’, self.admin_site.admin_view(self.add_view)),
    )
    return my_urls + urls

def add_view(self, request, extra_context=None):
    ctx = {
        ’app_label’: _(’VoIP’),
        ’title’: _(’Add VoIP’),
    }
    return super(VoipAppAdmin, self)
            .add_view(request, extra_context=ctx)




4.1. Sample Configuration                                                                                      51
Newfies-Dialer Documentation, Release 1.1.0



4.2 Celery Configuration

4.2.1 After installing Broker (Redis or Rabbitmq)

1. Redis Settings

This is a configuration example for Redis.
# Redis Settings
CARROT_BACKEND = "ghettoq.taproot.Redis"

BROKER_HOST = "localhost"            # Maps to redis host.
BROKER_PORT = 6379                   # Maps to redis port.
BROKER_VHOST = "0"                   # Maps to database number.

CELERY_RESULT_BACKEND = "redis"
REDIS_HOST = "localhost"
REDIS_PORT = 6379
REDIS_DB = 0
#REDIS_CONNECT_RETRY = True



2. Rabbitmq Settings

This is a configuration example for Rabbitmq.
BROKER_HOST = "localhost"
BROKER_PORT = 5672
BROKER_USER = "root"
BROKER_PASSWORD = "root"
BROKER_VHOST = "localhost"

CELERY_RESULT_BACKEND = "amqp"



4.2.2 Launch celery/celerybeat in debug mode

If you don’t want to run celeryd and celerybeat as a daemon then
To run celeryd
$ python manage.py celeryd -E -l debug

To run celerybeat
$ python manage.py celerybeat --schedule=/var/run/celerybeat-schedule

To run both
$ python manage.py celeryd -E -B -l debug



4.2.3 Running celeryd/celerybeat as a daemon (Debian/Ubuntu)

To configure celeryd you will need to tell it where to change directory to, when it starts in order to find your celerycon-
fig.



52                                                                       Chapter 4. Configuration and Defaults
Newfies-Dialer Documentation, Release 1.1.0



$ cd install/celery-init/etc/default/

  1. Open celeryd in text editor & change the following variables
     Configuration file: /etc/default/celeryd
     Init script: celeryd.
     Usage : /etc/init.d/celeryd {start|stop|force-reload|restart|try-restart|status}:
     # Where to chdir at start
     CELERYD_CHDIR="/path/to/newfies/"

     # Path to celeryd
     CELERYD="/path/to/newfies/manage.py celeryd"

     # Extra arguments to celeryd
     CELERYD_OPTS="--time-limit=300"

     # Name of the celery config module.
     CELERY_CONFIG_MODULE="celeryconfig"

     # Extra Available options
     # %n will be replaced with the nodename.
     # Full path to the PID file. Default is /var/run/celeryd.pid.
     CELERYD_PID_FILE="/var/run/celery/%n.pid"

     # Full path to the celeryd log file. Default is /var/log/celeryd.log
     CELERYD_LOG_FILE="/var/log/celery/%n.log"

     # User/Group to run celeryd as. Default is current user.
     # Workers should run as an unprivileged user.
     CELERYD_USER="celery"
     CELERYD_GROUP="celery"

  2. Open celeryd (for periodic task) in text editor & add the following variables
     Configuration file: /etc/default/celerybeat or /etc/default/celeryd
     Init script: celerybeat
     Usage: /etc/init.d/celerybeat {start|stop|force-reload|restart|try-restart|status}:
     # Path to celerybeat
     CELERYBEAT="/path/to/newfies/manage.py celerybeat"

     # Extra arguments to celerybeat
     CELERYBEAT_OPTS="--schedule=/var/run/celerybeat-schedule"

  3. Copy the configuration file & init scripts to /etc dir:
     $ cp etc/default/celeryd /etc/default/

     $ cp etc/init.d/celeryd /etc/init.d/

     $ cp etc/init.d/celerybeat /etc/init.d/

  4. Run/Start or Stop celery as a daemon:
     $ /etc/init.d/celeryd start or stop

     $ /etc/init.d/celerybeat start or stop


4.2. Celery Configuration                                                                                  53
Newfies-Dialer Documentation, Release 1.1.0




4.2.4 Troubleshooting

If you can’t get the celeryd as a daemon to work, you should try running them in verbose mode:
$ sh -x /etc/init.d/celeryd start

$ sh -x /etc/init.d/celerybeat start




54                                                                    Chapter 4. Configuration and Defaults
CHAPTER

                                                                                                              FIVE



               FREESWITCH INSTALLATION AND
                            CONFIGURATION

Contents:


5.1 Freeswitch Installation and configuration

Freeswitch is the telephony engine used by Newfies-Dialer to make calls, as well as broadcast voice applications
Newfies-Dialer communicates with Freeswitch though the Event-Socket. Communication is made via the Communi-
cations Framework Plivo. Our Freeswitch dependencies are the same as Plivo, therefore the following modules will
need to be installed
mod_curl, asr_tts, mod_flite, asr_tts, mod_shout, mod_dingaling, mod_shell_stream, mod_xml_cdr

In order to retrieve CDR Status from the outbound calls, you will have to configure xml_cdr.conf.xml and point it to
the Newfies API to store CDR, which is by default : http://hostname_newfies/api/dialer_cdr/store_cdr/
A script for Freeswitch Installation which will install Freeswitch with the required modules and configure it for you is
available.
Download and run the Freeswitch installation script.
Once logged in as root, execute the following command:
wget https://raw.github.com/Star2Billing/newfies-dialer/master/install/install-freeswitch.sh

The above commmand download the installation script. We can then execute the script with the following command:
bash install-freeswitch.sh

This will download and install Freeswitch with the modules appropriate for Newfies-Dialer. The installation will take
some time, but does not require your interaction once started.


5.2 Plivo Installation and configuration

When Freeswitch is installed, the next task is to install Plivo. Plivo is an open source communications framework to
rapidly deploy voice based applications used in conjunction with Newfies-Dialer.
Run the following commands:




                                                                                                                    55
Newfies-Dialer Documentation, Release 1.1.0



wget https://raw.github.com/plivo/plivo/master/scripts/plivo_install_beta.sh

then:
bash plivo_install_beta.sh /usr/share/plivo

This will download and install Plivo and all its dependencies. We need to have Plivo start on boot, so run the following
command to make it automatically start.
ln -s /usr/share/plivo/bin/plivo /etc/rc2.d/S99plivo
Please note that the Plivo script makes alterations to the Freeswitch dial-plan, so it should not be blindly run on an
existing working Freeswitch installation, as it will change your current configuration. If you wish to install Plivo on
an existing version of Freeswitch, use the script as a guide, or edit it to suit your requirements.


5.3 Freeswitch Trunk configuration

In order for Newfies-Dialer to make outbound calls to its subscribers, you will need a SIP trunk. The Freeswitch
wiki can provide more information on configuring trunks. However creating a trunk simply for Newfies-Dialer is
straightforward.
Trunks or gateways, as they are known in Freeswitch, are configured using XML syntax, so using your favourite text
editor, while logged in as root “sudo su -” create an XML file in /usr/local/freeswitch/conf/sip_profiles/external/ and
give it an identifiable name, e.g. call-labs.xml, and place the following lines in the file:
<include>
<gateway name="ip address or hostname of carrier">
<!--/// account username *required* ///-->
<param name="username" value="your username provided by carrier"/>
<!--/// auth realm: *optional* same as gateway name, if blank ///-->
<!--<param name="realm" value="asterlink.com"/>-->
<!--/// username to use in from: *optional* same as username, if blank ///-->
<param name="from-user" value="your username provided by carrier"/>
<!--/// domain to use in from: *optional* same as realm, if blank ///-->
<!--param name="from-domain" value=""/-->
<!--/// account password *required* ///-->
<param name="password" value="your password supplied by carrier"/>
<!--/// extension for inbound calls: *optional* same as username, if blank ///-->
<!--<param name="extension" value="cluecon"/>-->
<!--/// proxy host: *optional* same as realm, if blank ///-->
<!--<param name="proxy" value="asterlink.com"/>-->
<!--/// send register to this proxy: *optional* same as proxy, if blank ///-->
<!--<param name="register-proxy" value="mysbc.com"/>-->
<!--/// expire in seconds: *optional* 3600, if blank ///-->
<!--<param name="expire-seconds" value="60"/>-->
<!--/// do not register ///-->
<param name="register" value="true"/>
<!-- which transport to use for register -->
<!--<param name="register-transport" value="udp"/>-->
<!--How many seconds before a retry when a failure or timeout occurs -->
<!--<param name="retry-seconds" value="30"/>-->
<!--Use the callerid of an inbound call in the from field on outbound calls via this gateway -->
<!--<param name="caller-id-in-from" value="false"/>-->
<!--extra sip params to send in the contact-->
<!--<param name="contact-params" value="tport=tcp"/>-->
<!--send an options ping every x seconds, failure will unregister and/or mark it down-->
<!--<param name="ping" value="25"/>-->



56                                                     Chapter 5. FreeSwitch Installation and Configuration
Newfies-Dialer Documentation, Release 1.1.0



</gateway>
</include>

The uncommented lines are almost certainly required by your carrier and Freeswitch, the remaining parameters can
be uncommented and used, if required by your carrier. The XML syntax for comments are denoted by lines that begin
“ <!– “ and end in “–> “.
Finally we need to load the new configuration, and check the trunk is registered. Enter the Freeswitch CLI (Command
Line Interface) from the console:
/usr/local/freeswitch/bin/fs_cli

You should now see the Freeswitch CLI, so now reload the Freeswitch configuration with the following command:
(tip; Tab auto-completes):
sofia profile external restart reloadxml

When complete, check the trunk has registered with the command:
sofia status

Against the name of the trunk you configured in the XML file, you should see REGED (registered) at the end of the
line. Take a note of the trunk name, we are going to need it for telling Newfies-Dialer that it can use this trunk.
To exit the Freeswitch CLI, do CTRL D, or /exit
Freeswitch configuration is now complete.




5.3. Freeswitch Trunk configuration                                                                             57
Newfies-Dialer Documentation, Release 1.1.0




58                                           Chapter 5. FreeSwitch Installation and Configuration
CHAPTER

                                                                                                SIX



                                                              DEVELOPER DOC

Contents:


6.1 Prerequisites

To fully understand this project, developers will need to have a advanced knowledge of:
            • Django : http://www.djangoproject.com/
            • Celery : http://celeryproject.org/
            • Python : http://www.python.org/
            • Freeswitch : http://freeswitch.org/
            • Freeswitch : Event_Sockets (wiki.freeswitch.org/wiki/Mod_event_socket)


6.2 Coding Style & Structure

6.2.1 Style

Coding follows the PEP 8 Style Guide for Python Code.


6.2.2 Structure

The newfies directory:
|--   custom_admin_tools          - The code for admin dashboard/menu
|--   dialer_campaign             - The code for dialer campaign
|     |-- api
|     ‘-- fixtures
|--   dialer_cdr                  - This defines the call request & its information
|     |-- api
|     ‘-- fixtures
|--   dialer_gateway              - This defines the trunk to deliver the VoIP Calls
|     ‘-- fixtures
|--   dialer_settings             - This defines sets of settings to apply on user
|--   voip_app                    - This defines application that are defined on the platform
|     ‘-- fixtures
|--   static



                                                                                                 59
Newfies-Dialer Documentation, Release 1.1.0



|     |-- newfies
|     |    |-- css
|     |    |-- js
|     |    ‘-- images
|--   user_profile        - The code for user profile to extend auth model of Django
|--   resources           - This area is used to hold media files
‘--   templates           - This area is used to override templates
      |-- admin
      |   |-- dialer_campaign
      |   ‘-- dialer_cdr
      |-- admin_tools
      |-- registration
      |-- memcache_status
      ‘-- frontend



6.3 Objects Description

6.3.1 Phonebook

class dialer_campaign.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


6.3.2 Contact

class dialer_campaign.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



60                                                                                 Chapter 6. Developer doc
Newfies-Dialer Documentation, Release 1.1.0


     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


6.3.3 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


6.3.4 Campaign

class dialer_campaign.models.Campaign(*args, **kwargs)
      This defines the Campaign
     Attributes:
         •campaign_code - Autogenerate 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 retry allowed per user
         •maxretry - Max retry allowed per user
         •intervalretry - Time to wait between retries in seconds
         •calltimeout - Number of seconds to timeout on calls
         •aleg_gateway - Gateway to use to reach the contact
         •extra_data - Additional data to pass to the application


6.3. Objects Description                                                                                       61
Newfies-Dialer Documentation, Release 1.1.0


     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: dialer_campaign
     campaignsubscriber_detail()
         This will link to campaign subscribers who are associated with the campaign
     count_contact_of_phonebook(status=None)
         Count the no. of Contacts in a phonebook
     get_active_callmaxduration()
         Get the active call max duration
     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 campaign
     is_authorized_contact(str_contact)
         Check if a contact is authorized
     progress_bar()
         Progress bar generated based on no of contacts
     update_campaign_status()
         Update the campaign’s status
          For example, If campaign is active, you can change status to ‘Pause’ or ‘Stop’


6.3.5 CampaignSubscriber

class dialer_campaign.models.CampaignSubscriber(*args, **kwargs)
      This defines the Contact imported to a Campaign
     Attributes:
         •last_attempt -
         •count_attempt -
         •duplicate_contact -
         •status -
     Relationships:
         •contact - Foreign key relationship to the Contact model.


62                                                                                  Chapter 6. Developer doc
Newfies-Dialer Documentation, Release 1.1.0


           •campaign - Foreign key relationship to the Campaign model.
      Name of DB table: dialer_campaign_subscriber


6.3.6 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
           •campaign_subscriber - Foreign key relationship to the CampaignSubscriber Model.
           •campaign - Foreign key relationship to the Campaign model.
      Name of DB table: dialer_callrequest


6.3.7 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:


6.3. Objects Description                                                                                    63
Newfies-Dialer Documentation, Release 1.1.0


           •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


6.3.8 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 gate-
            way separated by comma
           •gateway_timeouts - “10,10”, # Seconds to timeout in string for each gateway separated by comma




64                                                                                     Chapter 6. Developer doc
Newfies-Dialer Documentation, Release 1.1.0


         •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


6.3.9 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_number_campaign - Max Number of campaigns
         •max_number_subscriber_campaign - Max Number of subscribera
         •blacklist - Used to blacklist phone numbers to be called
         •whitelist - Used to whitelist phone numbers to be called
     Name of DB table: dialer_setting


6.3.10 UserProfile

class user_profile.models.UserProfile(*args, **kwargs)
      This defines extra features for the user
     Attributes:
         •accountcode - Account name.
     Relationships:
         •user - Foreign key relationship to the User model.
         •userprofile_gateway - ManyToMany
         •userprofile_voipservergroup - ManyToMany
         •dialersetting - Foreign key relationship to the DialerSetting model.


6.3. Objects Description                                                                                  65
Newfies-Dialer Documentation, Release 1.1.0


     Name of DB table: user_profile


6.4 Database Design

The current database schema is shown below:




6.5 Newfies-Dialer Views

6.5.1 index

     dialer_campaign.views.index(request)
         Index view of the Customer Interface
           Attributes:
              •form - LoginForm
              •template - frontend/index.html


6.5.2 customer_dashboard

     dialer_campaign.views.customer_dashboard(request, *args, **kwargs)
         Customer dashboard gives the following information
              •No of Campaigns for logged in user
              •Total phonebook contacts
              •Total Campaigns contacts
              •Amount of contact reached today
              •Disposition of calls via pie chart
              •Call records & Duration of calls are shown on graph by days/hours basis.
           Attributes:
              •template - frontend/dashboard.html


66                                                                                 Chapter 6. Developer doc
Newfies-Dialer Documentation, Release 1.1.0


             •form - DashboardForm


6.5.3 login_view

    dialer_campaign.views.login_view(request)
        Check User credentials
         Attributes:
             •form - LoginForm
             •template - frontend/index.html
         Logic Description:
             •Submitted user credentials need to be checked. If it is not valid then the system will redirect to
              the login page.
             •If submitted user credentials are valid then system will redirect to the dashboard.


6.5.4 cust_password_reset

    dialer_campaign.views.cust_password_reset(request)
        Use django.contrib.auth.views.password_reset view method for forgotten pass-
        word on the Customer UI
         This method sends an e-mail to the user’s email-id which is entered in password_reset_form


6.5.5 cust_password_reset_done

    dialer_campaign.views.cust_password_reset_done(request)
        Use django.contrib.auth.views.password_reset_done view method for forgotten
        password on the Customer UI
         This will show a message to the user who is seeking to reset their password.


6.5.6 cust_password_reset_confirm

    dialer_campaign.views.cust_password_reset_confirm(request, uidb36=None,
                                                       token=None)
        Use django.contrib.auth.views.password_reset_confirm view method for for-
        gotten password on the Customer UI
         This will allow a user to reset their password.


6.5.7 common_send_notification

    dialer_campaign.views.common_send_notification(request,                             status,    recipi-
                                                                            ent=None)
        User Notification (e.g. start | stop | pause | abort | contact/camapign limit) needs to be saved. It is a
        common function for the admin and customer UI’s
         Attributes:
             •pk - primary key of the campaign record



6.5. Newfies-Dialer Views                                                                                           67
Newfies-Dialer Documentation, Release 1.1.0


              •status - get label for notifications
          Logic Description:
              •This  function is used  by   update_campaign_status_admin()                                   &
               update_campaign_status_cust()


6.5.8 common_campaign_status

     dialer_campaign.views.common_campaign_status(pk, status)
         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:
              •pk - primary key of the campaign record
              •status - selected status for the campaign record
          Logic Description:
              •Selected Campaign’s status needs to be changed. Changed status can be start, stop or pause.
              •This  function is used  by   update_campaign_status_admin()                                   &
               update_campaign_status_cust()


6.5.9 phonebook_list

     dialer_campaign.views.phonebook_list(request, *args, **kwargs)
         Phonebook list for the logged in user
          Attributes:
              •template - frontend/phonebook/list.html
          Logic Description:
              •List all phonebooks which belong to the logged in user.


6.5.10 phonebook_grid

     dialer_campaign.views.phonebook_grid(request, *args, **kwargs)
         Phonebook list in json format for flexigrid.
          Model: Phonebook
          Fields: [id, name, description, updated_date]


6.5.11 phonebook_add

          dialer_campaign.views.phonebook_add(request, *args, **kwargs)
             Add new Phonebook for the logged in user
               Attributes:
                  •form - PhonebookForm
                  •template - frontend/phonebook/change.html
               Logic Description:



68                                                                                  Chapter 6. Developer doc
Newfies-Dialer Documentation, Release 1.1.0


                •Add a new phonebook which will belong to the logged in user via the phonebookForm
                 & get redirected to the phonebook list

6.5.12 phonebook_change

    dialer_campaign.views.phonebook_change(request, *args, **kwargs)
        Update/Delete Phonebook for the logged in user
         Attributes:
            •object_id - Selected phonebook object
            •form - PhonebookForm
            •template - frontend/phonebook/change.html
         Logic Description:
            •Update/delete selected phonebook from the phonebook list via PhonebookForm & get redi-
             rected to phonebook list


6.5.13 contact_list

    dialer_campaign.views.contact_list(request, *args, **kwargs)
        Contact list for the logged in user
         Attributes:
            •template - frontend/contact/list.html
            •form - ContactSearchForm
         Logic Description:
            •List all contacts from phonebooks belonging to the logged in user


6.5.14 contact_grid

    dialer_campaign.views.contact_grid(request, *args, **kwargs)
        Contact list in json format for flexigrid
         Model: Contact
         Fields: [id, phonebook__name, contact, last_name, first_name, description,        status,      addi-
             tional_vars, updated_date]


6.5.15 contact_add

         dialer_campaign.views.contact_add(request, *args, **kwargs)
            Add a new contact into the selected phonebook for the logged in user
             Attributes:
                •form - ContactForm
                •template - frontend/contact/change.html
             Logic Description:
                •Before adding a contact, check dialer setting limit if applicable to the user.
                •Add new contact belonging to the logged in user via ContactForm & get redirected to
                 the contact list


6.5. Newfies-Dialer Views                                                                                       69
Newfies-Dialer Documentation, Release 1.1.0


6.5.16 contact_change

     dialer_campaign.views.contact_change(request, *args, **kwargs)
         Update/Delete contact for the logged in user
         Attributes:
            •object_id - Selected contact object
            •form - ContactForm
            •template - frontend/contact/change.html
         Logic Description:
            •Update/delete selected contact from the contact list via ContactForm & get redirected to the
             contact list


6.5.17 contact_import

     dialer_campaign.views.contact_import(request, *args, **kwargs)
         Import CSV file of Contacts for the logged in user
         Attributes:
            •form - Contact_fileImport
            •template - frontend/contact/import_contact.html
         Logic Description:
            •Before adding contacts, check dialer setting limit if applicable to the user.
            •Add new contacts which will belong to the logged in user via csv file & get the result (upload
             success and failure statistics)
         Important variable:
            •total_rows - Total no. of records in the CSV file
            •retail_record_count - No. of records imported from the CSV file


6.5.18 campaign_list

     dialer_campaign.views.campaign_list(request, *args, **kwargs)
         List all campaigns for the logged in user
         Attributes:
            •template - frontend/campaign/list.html
         Logic Description:
            •List all campaigns belonging to the logged in user


6.5.19 campaign_grid

     dialer_campaign.views.campaign_grid(request, *args, **kwargs)
         Campaign list in json format for flexigrid
         Model: Campaign


70                                                                                    Chapter 6. Developer doc
Newfies-Dialer Documentation, Release 1.1.0


6.5.20 campaign_add

      dialer_campaign.views.campaign_add(request, *args, **kwargs)
          Add a new campaign for the logged in user
           Attributes:
               •form - CampaignForm
               •template - frontend/campaign/change.html
           Logic Description:
               •Before adding a campaign, check dialer setting limit if applicable to the user.
               •Add the new campaign which will belong to the logged in user via CampaignForm & get redi-
                rected to campaign list


6.5.21 campaign_change

      dialer_campaign.views.campaign_change(request, *args, **kwargs)
          Update/Delete campaign for the logged in user
           Attributes:
               •object_id - Selected campaign object
               •form - CampaignForm
               •template - frontend/campaign/change.html
           Logic Description:
               •Update/delete selected campaign from the campaign list via CampaignForm & get redirected to
                the campaign list


6.6 Newfies-Dialer Admin Views

6.6.1 CampaignAdmin

class dialer_campaign.admin.CampaignAdmin(model, admin_site)
      Allows the administrator to view and modify certain attributes of a Campaign.
      add_view(request, extra_context=None)
          Override django add_view method for checking the dialer setting limit
           Logic Description:
               •Before adding campaign, checked dialer setting limit if applicable to the user, if matched, the user
                will be redirected to the campaign list


6.6.2 PhonebookAdmin

class dialer_campaign.admin.PhonebookAdmin(model, admin_site)
      Allows the administrator to view and modify certain attributes of a Phonebook.




6.6. Newfies-Dialer Admin Views                                                                                   71
Newfies-Dialer Documentation, Release 1.1.0


6.6.3 ContactAdmin

class dialer_campaign.admin.ContactAdmin(model, admin_site)
      Allows the administrator to view and modify certain attributes of a Contact.
      add_view(request, extra_context=None)
          Override django admin add_view method for checking the dialer setting limit
           Logic Description:
               •Before adding a contact, check the dialer setting limit if applicable to the user. If matched, the user
                will be redirected to the contact list
      import_contact(request)
          Add custom method in django admin view to import CSV file of Contacts
           Attributes:
               •form - Contact_fileImport
               •template - admin/dialer_campaign/contact/import_contact.html
           Logic Description:
               •Before adding contact, check the dialer setting limit if applicable to the user.
               •Add a new contact which will belong to the logged in user via csv file & get the result (Upload success
                & failure statistics)
           Important variable:
               •total_rows - Total no. of records in the CSV file
               •retail_record_count - No. of records which are imported from The CSV file


6.6.4 CampaignSubscriberAdmin

class dialer_campaign.admin.CampaignSubscriberAdmin(model, admin_site)
      Allows the administrator to view and modify certain attributes of a CampaignSubscriber.


6.6.5 CallrequestAdmin

class dialer_cdr.admin.CallrequestAdmin(model, admin_site)
      Allows the administrator to view and modify certain attributes of a Callrequest.


6.6.6 VoIPCallAdmin

class dialer_cdr.admin.VoIPCallAdmin(model, admin_site)
      Allows the administrator to view and modify certain attributes of a VoIPCall.
      changelist_view(request, extra_context=None)
          Override changelist_view method of django-admin for search parameters
           Attributes:
               •form - VoipSearchForm
               •template - admin/dialer_cdr/voipcall/change_list.html
           Logic Description:


72                                                                                       Chapter 6. Developer doc
Newfies-Dialer Documentation, Release 1.1.0


               •VoIP report Record Listing with search option & Daily Call Report search Parameters: by date, by
                status and by billed.
      export_voip_report(request)
          Export a CSV file of VoIP call records
           Important variable:
               •request.session[’voipcall_record_qs’] - stores voipcall query set

           Exported fields: [user, callid, callerid, phone_number, starting_date,           duration,   disposition,
              used_gateway]

      has_add_permission(request)
          Remove add permission on VoIP Call Report model
           Logic Description:
               •Override django admin has_add_permission method to remove add permission on VoIP Call Report
                model
      used_gateway_link(obj)
          Used gateway link to edit gateway detail
      user_link(obj)
          User link to user profile


6.6.7 GatewayAdmin

class dialer_gateway.admin.GatewayAdmin(model, admin_site)
      Allows the administrator to view and modify certain attributes of a Gateway.


6.6.8 DialerSettingAdmin

class dialer_settings.admin.DialerSettingAdmin(model, admin_site)
      Allows the administrator to view and modify certain attributes of a DialerSetting.
      add_view(request, extra_context=None)
          Add Dialer setting
      change_view(request, object_id, extra_context=None)
          Edit dialer settings
      changelist_view(request, extra_context=None)
          Dialer setting list


6.7 Newfies Tasks

class dialer_campaign.tasks.check_campaign_pendingcall
      This will execute the outbound calls in the campaign
      Attributes:
          •campaign_id - Campaign ID




6.7. Newfies Tasks                                                                                               73
Newfies-Dialer Documentation, Release 1.1.0


class dialer_campaign.tasks.campaign_running
      A periodic task that checks the campaign, create and tasks the calls
      Usage:
           campaign_running.delay()
class dialer_campaign.tasks.collect_subscriber
      This task will collect all the subscribers
      Attributes:
          •campaign_id - Campaign ID
class dialer_cdr.tasks.init_callrequest
      This task outbounds the call
      Attributes:
          •callrequest_id - Callrequest ID
class dialer_cdr.tasks.callrequest_pending
      A periodic task that checks for pending calls
      Usage:
           callrequest_pending.delay()


6.8 Newfies Signals

6.8.1 post_save_add_contact

      dialer_campaign.models.post_save_add_contact(sender, **kwargs)
          A post_save signal is sent by the Contact model instance whenever it is going to save.
           Logic Description:
               •When new contact is added into Contact model, active the campaign list will be checked with
                the contact status.
               •If the active campaign list count is more than one & the contact is active, the contact will be
                added into CampaignSubscriber model.


6.9 Test Case Descriptions

6.9.1 Requirement

Run/Start Celery:
$ /etc/init.d/celery start

or:
$ python manage.py celeryd -l info

Run/Start Redis:




74                                                                                    Chapter 6. Developer doc
Newfies-Dialer Documentation, Release 1.1.0



$ /etc/init.d/redis-server start



6.9.2 How to run test

1. Run Full Test Suit:
$ python manage.py test --verbosity=2

2. Run NewfiesTastypieApiTestCase:
$ python manage.py test dialer_cdr.NewfiesTastypieApiTestCase --verbosity=2

3. Run NewfiesAdminInterfaceTestCase:
$ python manage.py test dialer_cdr.NewfiesAdminInterfaceTestCase --verbosity=2

4. Run NewfiesCustomerInterfaceTestCase:
$ python manage.py test dialer_cdr.NewfiesCustomerInterfaceTestCase --verbosity=2



6.9.3 Tastypie API Test Case

class dialer_cdr.tests.NewfiesTastypieApiTestCase(methodName=’runTest’)
      Test cases for Newfies-Dialer API.
      test_create_answercall()
          Test Function to create a answercall
      test_create_bulk_contact()
          Test Function to bulk create contacts
      test_create_callrequest()
          Test Function to create a callrequest
      test_create_campaign()
          Test Function to create a campaign
      test_create_campaign_subscriber()
          Test Function to create a campaign subscriber
      test_create_cdr()
          Test Function to create a CDR
      test_create_hangupcall()
          Test Function to create a hangupcall
      test_create_phonebook()
          Test Function to create a phonebook
      test_create_survey()
          Test Function to create a survey
      test_create_survey_question()
          Test Function to create a survey question
      test_create_survey_response()
          Test Function to create a survey response




6.9. Test Case Descriptions                                                                      75
Newfies-Dialer Documentation, Release 1.1.0


     test_delete_campaign()
         Test Function to delete a campaign
     test_delete_cascade_campaign()
         Test Function to cascade delete a campaign
     test_read_callrequest()
         Test Function to get all callrequests
     test_read_campaign()
         Test Function to get all campaigns
     test_read_campaign_subscriber()
         Test Function to get all campaign subscriber
     test_read_phonebook()
         Test Function to get all phonebooks
     test_read_survey()
         Test Function to get all surveys
     test_read_survey_question()
         Test Function to get all survey questions
     test_read_survey_response()
         Test Function to get all survey response
     test_update_campaign()
         Test Function to update a campaign
     test_update_campaign_subscriber()
         Test Function to update a campaign subscriber
     test_update_survey()
         Test Function to update a survey
     test_update_survey_question()
         Test Function to update a survey question
     test_update_survey_response()
         Test Function to update a survey response


6.9.4 Admin Interface Test Case

class dialer_cdr.tests.NewfiesAdminInterfaceTestCase(methodName=’runTest’)
      Test cases for Newfies Admin Interface.
     setUp()
         To create admin user
     test_admin_index()
         Test Function to check Admin index page
     test_admin_newfies()
         Test Function to check Newfies Admin pages


6.9.5 Customer Interface Test Case

class dialer_cdr.tests.NewfiesCustomerInterfaceTestCase(methodName=’runTest’)
      Test cases for Newfies Customer Interface.


76                                                             Chapter 6. Developer doc
Newfies-Dialer Documentation, Release 1.1.0


     test_campaign_view()
         Test Function to check campaign
     test_contact_view()
         Test Function to check Contact
     test_dashboard()
         Test Function to check customer dashboard
     test_index()
         Test Function to check customer index page
     test_phonebook_view()
         Test Function to check phonebook
     test_survey_view()
         Test Function survey view
     test_user_settings()
         Test Function to check User settings
     test_voiceapp_view()
         Test Function to check voiceapp
     test_voip_call_report()
         Test Function to check VoIP call report


6.9.6 Customer Interface Forgot Test Case

class dialer_cdr.tests.NewfiesCustomerInterfaceForgotPassTestCase(methodName=’runTest’)
      Test cases for Newfies Customer Interface. for forgot password
     test_check_password_reset()
         Test Function to check password reset




6.9. Test Case Descriptions                                                                  77
Newfies-Dialer Documentation, Release 1.1.0




78                                           Chapter 6. Developer doc
CHAPTER

                                                                                                 SEVEN



                                                                  API REFERENCE

Contents:


7.1 CampaignResource

class api.resources.CampaignResource(api_name=None)
      Attributes:
               •campaign_code - Autogenerate campaign code
               •name - Name of the Campaign
               •description - Short description of the Campaign
               •callerid - Caller ID
               •startingdate - Start date. Epoch Time, ie 1301414368
               •expirationdate - Expiry date. Epoch Time, ie 1301414368
               •daily_start_time - Daily start time, default ‘00:00:00’
               •daily_stop_time - Daily stop time, default ‘23:59:59’
               •monday - Set to 1 if you want to run this day of the week, default ‘1’
               •tuesday - Set to 1 if you want to run this day of the week, default ‘1’
               •wednesday - Set to 1 if you want to run this day of the week , default ‘1’
               •thursday - Set to 1 if you want to run this day of the week, default ‘1’
               •friday - Set to 1 if you want to run this day of the week, default ‘1’
               •saturday - Set to 1 if you want to run this day of the week, default ‘1’
               •sunday - Set to 1 if you want to run this day of the week, default ‘1’
            Campaign Settings:
               •frequency - Defines the frequency, speed of the campaign. This is the number of calls per
                minute.
               •callmaxduration - Maximum call duration.
               •maxretry - Defines the max retries allowed per user.
               •intervalretry - Defines the time to wait between retries in seconds
               •calltimeout - Defines the number of seconds to timeout on calls


                                                                                                           79
Newfies-Dialer Documentation, Release 1.1.0


          Gateways:
               •aleg_gateway - Defines the Gateway to use to call the subscriber
               •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
               •extra_data - Defines the additional data to pass to the application
     Validation:
         •CampaignValidation()
     Create:
          CURL Usage:
          curl -u username:password --dump-header - -H "Content-Type:application/json" -X POST --data

          Response:
          HTTP/1.0 200 OK
          Date: Thu, 08 Dec 2011 13:05:50 GMT
          Server: WSGIServer/0.1 Python/2.7.1+
          Vary: Accept-Language, Cookie
          Content-Type: text/html; charset=utf-8
          Location: http://localhost:8000/api/app/campaign/1/
          Content-Language: en-us

     Read:
          CURL Usage:
          curl -u username:password -H ’Accept: application/json’ http://localhost:8000/api/v1/campaig

          Response:
          {
               "meta":{
                  "limit":20,
                  "next":null,
                  "offset":0,
                  "previous":null,
                  "total_count":1
               },
               "objects":[
                  {
                     "callerid":"123987",
                     "callmaxduration":1800,
                     "calltimeout":45,
                     "campaign_code":"XIUER",
                     "created_date":"2011-06-15T00:49:16",
                     "daily_start_time":"00:00:00",
                     "daily_stop_time":"23:59:59",
                     "description":"",
                     "expirationdate":"2011-06-22T00:01:15",
                     "extra_data":"",
                     "frequency":10,
                     "friday":true,
                     "id":"1",
                     "intervalretry":3,



80                                                                                   Chapter 7. API Reference
Newfies-Dialer Documentation, Release 1.1.0



                      "maxretry":3,
                      "monday":true,
                      "name":"Default_Campaign",
                      "resource_uri":"/api/app/campaign/1/",
                      "saturday":true,
                      "startingdate":"2011-06-15T00:01:15",
                      "status":1,
                      "sunday":true,
                      "thursday":true,
                      "tuesday":true,
                      "updated_date":"2011-06-15T00:49:16",
                      "content_type":"/api/v1/contrib/contenttype/1/",
                      "object_id":1,
                      "wednesday":true
                  }
              ]
         }

    Update:
         CURL Usage:
         curl -u username:password --dump-header - -H "Content-Type: application/json" -X PUT --data

         Response:
         HTTP/1.0 204 NO CONTENT
         Date: Fri, 23 Sep 2011 06:46:12 GMT
         Server: WSGIServer/0.1 Python/2.7.1+
         Vary: Accept-Language, Cookie
         Content-Length: 0
         Content-Type: text/html; charset=utf-8
         Content-Language: en-us

    Delete:
         CURL Usage:
         curl -u username:password --dump-header - -H "Content-Type: application/json" -X DELETE   htt

         curl -u username:password --dump-header - -H "Content-Type: application/json" -X DELETE   htt

         Response:
         HTTP/1.0 204 NO CONTENT
         Date: Fri, 23 Sep 2011 06:48:03 GMT
         Server: WSGIServer/0.1 Python/2.7.1+
         Vary: Accept-Language, Cookie
         Content-Length: 0
         Content-Type: text/html; charset=utf-8
         Content-Language: en-us

    Search:
         CURL Usage:
         curl -u username:password -H ’Accept: application/json’ http://localhost:8000/api/v1/campaig

         Response:




7.1. CampaignResource                                                                     81
Newfies-Dialer Documentation, Release 1.1.0



         {
             "meta":{
                "limit":20,
                "next":null,
                "offset":0,
                "previous":null,
                "total_count":1
             },
             "objects":[
                {
                   "aleg_gateway":{

                       "created_date":"2011-06-15T00:28:52",
                       "description":"",
                       "id":"1",
                       "maximum_call":null,
                       "name":"Default_Gateway",
                     },
                     "callerid":"1239876",
                     "callmaxduration":50,
                     "calltimeout":45,
                     "campaign_code":"DJZVK",
                     "created_date":"2011-10-13T02:06:22",
                     "daily_start_time":"00:00:00",
                     "daily_stop_time":"23:59:59",
                     "description":"",
                     "expirationdate":"2011-03-28T17:08:56",
                     "extra_data":"2000",
                     "frequency":20,
                     "friday":true,
                     "id":"16",
                     "intervalretry":3000,
                     "maxretry":3,
                     "monday":true,
                     "name":"mycampaign2",
                     "resource_uri":"/api/v1/campaign/16/",
                     "saturday":true,
                     "startingdate":"2011-03-29T09:48:56",
                     "status":2,
                     "sunday":true,
                     "thursday":true,
                     "tuesday":true,
                     "updated_date":"2011-10-13T02:06:22",
                     "user":{
                        "id":"1",
                        "username":"areski"
                     },
                     "content_type":"/api/v1/contrib/contenttype/1/",
                     "object_id":1,
                     "wednesday":true
                 }
             ]
         }




82                                                                 Chapter 7. API Reference
Newfies-Dialer Documentation, Release 1.1.0



7.2 CampaignDeleteCascadeResource

class api.resources.CampaignDeleteCascadeResource(api_name=None)
      Attributes:
        •campaign_id - Campaign ID
    CURL Usage:
    curl -u username:password --dump-header - -H "Content-Type: application/json" -X DELETE         http://

    Example Response:
    HTTP/1.0 204 NO CONTENT
    Date: Wed, 18 May 2011 13:23:14 GMT
    Server: WSGIServer/0.1 Python/2.6.2
    Vary: Authorization
    Content-Length: 0
    Content-Type: text/plain



7.3 PhonebookResource

class api.resources.PhonebookResource(api_name=None)
      Attributes:
        •name - Name of the Phonebook
        •description - Short description of the Campaign
        •campaign_id - Campaign ID
    Validation:
        •PhonebookValidation()
    Create:
         CURL Usage:
         curl -u username:password --dump-header - -H "Content-Type:application/json" -X POST --data

         Response:
         HTTP/1.0 201 CREATED
         Date: Fri, 23 Sep 2011 06:08:34 GMT
         Server: WSGIServer/0.1 Python/2.7.1+
         Vary: Accept-Language, Cookie
         Content-Type: text/html; charset=utf-8
         Location: http://localhost:8000/api/app/phonebook/1/
         Content-Language: en-us

    Read:
         CURL Usage:
         curl -u username:password -H ’Accept: application/json’ http://localhost:8000/api/v1/phonebo

         Response:




7.2. CampaignDeleteCascadeResource                                                            83
Newfies-Dialer Documentation, Release 1.1.0



          {
               "meta":{
                  "limit":20,
                  "next":null,
                  "offset":0,
                  "previous":null,
                  "total_count":1
               },
               "objects":[
                  {
                     "created_date":"2011-04-08T07:55:05",
                     "description":"This is default phone book",
                     "id":"1",
                     "name":"Default_Phonebook",
                     "resource_uri":"/api/v1/phonebook/1/",
                     "updated_date":"2011-04-08T07:55:05",
                     "user":{
                        "first_name":"",
                        "id":"1",
                        "last_login":"2011-10-11T01:03:42",
                        "last_name":"",
                        "resource_uri":"/api/v1/user/1/",
                        "username":"areski"
                     }
                  }
               ]
          }

     Update:
          CURL Usage:
          curl -u username:password --dump-header - -H "Content-Type: application/json" -X PUT --data

          Response:
          HTTP/1.0 204 NO CONTENT
          Date: Fri, 23 Sep 2011 06:46:12 GMT
          Server: WSGIServer/0.1 Python/2.7.1+
          Vary: Accept-Language, Cookie
          Content-Length: 0
          Content-Type: text/html; charset=utf-8
          Content-Language: en-us

     Delete:
          CURL Usage:
          curl -u username:password --dump-header - -H "Content-Type: application/json" -X DELETE   htt

          curl -u username:password --dump-header - -H "Content-Type: application/json" -X DELETE   htt

          Response:
          HTTP/1.0 204 NO CONTENT
          Date: Fri, 23 Sep 2011 06:48:03 GMT
          Server: WSGIServer/0.1 Python/2.7.1+
          Vary: Accept-Language, Cookie
          Content-Length: 0




84                                                                 Chapter 7. API Reference
Newfies-Dialer Documentation, Release 1.1.0



         Content-Type: text/html; charset=utf-8
         Content-Language: en-us

    Search:
         CURL Usage:
         curl -u username:password -H ’Accept: application/json’ http://localhost:8000/api/v1/phonebo



7.4 BulkContactResource

class api.resources.BulkContactResource(api_name=None)
      API to bulk create contacts
    Attributes
        •contact - contact number of the Subscriber
        •phonebook_id - the phonebook Id to which we want to add the contact
    Validation:
        •BulkContactValidation()
    CURL Usage:
    curl -u username:password --dump-header - -H "Content-Type:application/json" -X POST --data ’{"p

    Response:
    HTTP/1.0 201 CREATED
    Date: Thu, 13 Oct 2011 11:42:44 GMT
    Server: WSGIServer/0.1 Python/2.7.1+
    Vary: Accept-Language, Cookie
    Content-Type: text/html; charset=utf-8
    Location: http://localhost:8000/api/v1/bulkcontact/None/
    Content-Language: en-us



7.5 CampaignSubscriberResource

class api.resources.CampaignSubscriberResource(api_name=None)
      Attributes Details:
        •contact - contact number of the Subscriber
        •last_name - last name of the Subscriber
        •first_name - first name of the Subscriber
        •email - email id of the Subscriber
        •description - Short description of the Subscriber
        •additional_vars - Additional settings for the Subscriber
        •phonebook_id - the phonebook Id to which we want to add the Subscriber
    Validation:
        •CampaignSubscriberValidation()


7.4. BulkContactResource                                                                        85
Newfies-Dialer Documentation, Release 1.1.0


     Create:
         CURL Usage:
         curl -u username:password --dump-header - -H "Content-Type:application/json" -X POST --data

         Response:
         HTTP/1.0 204 NO CONTENT
         Date: Wed, 18 May 2011 13:23:14 GMT
         Server: WSGIServer/0.1 Python/2.6.2
         Vary: Authorization
         Content-Length: 0
         Content-Type: text/plain

     Read:
         CURL Usage:
         curl -u username:password -H ’Accept: application/json’ http://localhost:8000/api/v1/campaig

               or

         curl -u username:password -H ’Accept: application/json’ http://localhost:8000/api/v1/campaig

         Response:
     Update:
         CURL Usage:
         curl -u username:password --dump-header - -H "Content-Type: application/json" -X PUT --data

         Response:
         HTTP/1.0 204 NO CONTENT
         Date: Fri, 23 Sep 2011 06:46:12 GMT
         Server: WSGIServer/0.1 Python/2.7.1+
         Vary: Accept-Language, Cookie
         Content-Length: 0
         Content-Type: text/html; charset=utf-8
         Content-Language: en-us



7.6 CallrequestResource

class api.resources.CallrequestResource(api_name=None)
      Attributes:
         •request_uuid - Unique id
         •call_time - Total call time
         •call_type - Call type
         •status - Call request status
         •callerid - Caller ID
         •callrequest_id- Callrequest Id
         •timeout -



86                                                              Chapter 7. API Reference
Newfies-Dialer Documentation, Release 1.1.0


        •timelimit -
        •status -
        •campaign_subscriber -
        •campaign -
        •phone_number -
        •extra_dial_string -
        •extra_data -
        •num_attempt -
        •last_attempt_time -
        •result -
        •hangup_cause -
        •last_attempt_time -
    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
    Validation:
        •CallrequestValidation()
    Create:
         CURL Usage:
         curl -u username:password --dump-header - -H "Content-Type:application/json" -X POST --data

         Response:
         HTTP/1.0 201 CREATED
         Date: Fri, 23 Sep 2011 06:08:34 GMT
         Server: WSGIServer/0.1 Python/2.7.1+
         Vary: Accept-Language, Cookie
         Content-Type: text/html; charset=utf-8
         Location: http://localhost:8000/api/app/campaign/1/
         Content-Language: en-us

    Read:
         CURL Usage:
         curl -u username:password -H ’Accept: application/json’ http://localhost:8000/api/v1/callreq

         curl -u username:password -H ’Accept: application/json’ http://localhost:8000/api/v1/callreq

         Response:
         {
              "meta":{
                 "limit":20,
                 "next":null,
                 "offset":0,



7.6. CallrequestResource                                                                             87
Newfies-Dialer Documentation, Release 1.1.0



                 "previous":null,
                 "total_count":1
               },
               "objects":[
                  {
                     "call_time":"2011-10-20T12:21:22",
                     "call_type":1,
                     "callerid":"650784355",
                     "created_date":"2011-10-14T07:33:41",
                     "extra_data":"",
                     "extra_dial_string":"",
                     "hangup_cause":"",
                     "id":"1",
                     "last_attempt_time":null,
                     "num_attempt":0,
                     "phone_number":"8792749823",
                     "request_uuid":"2342jtdsf-00123",
                     "resource_uri":"/api/v1/callrequest/1/",
                     "result":"",
                     "status":1,
                     "timelimit":3600,
                     "timeout":30000,
                     "updated_date":"2011-10-14T07:33:41",
                     "user":{
                        "first_name":"",
                        "id":"1",
                        "last_login":"2011-10-11T01:03:42",
                        "last_name":"",
                        "resource_uri":"/api/v1/user/1/",
                        "username":"areski"
                     },
                  }
               ]
         }

     Update:
         CURL Usage:
         curl -u username:password --dump-header - -H "Content-Type: application/json" -X PUT --data

         Response:
         HTTP/1.0 204 NO CONTENT
         Date: Fri, 23 Sep 2011 06:46:12 GMT
         Server: WSGIServer/0.1 Python/2.7.1+
         Vary: Accept-Language, Cookie
         Content-Length: 0
         Content-Type: text/html; charset=utf-8
         Content-Language: en-us



7.7 CdrResource

class api.resources.CdrResource(api_name=None)
      Attributes:
        •cdr - XML string assigned from the Telephony engine


88                                                              Chapter 7. API Reference
Newfies-Dialer Documentation, Release 1.1.0


    Validation:
        •CdrValidation()
    Create:
         CURL Usage:
         curl -u username:password --dump-header - -H "Content-Type:application/json" -X POST --data

         Response:
         HTTP/1.0 201 CREATED
         Date: Fri, 23 Sep 2011 06:08:34 GMT
         Server: WSGIServer/0.1 Python/2.7.1+
         Vary: Accept-Language, Cookie
         Content-Type: text/html; charset=utf-8
         Location: http://localhost:8000/api/v1/store_cdr/None/
         Content-Language: en-us



7.8 AnswercallResource

class api.resources.AnswercallResource(api_name=None)
      Attributes:
        •RequestUUID - A unique identifier for the API request.
    Create:
         CURL Usage:
         curl -u username:password --dump-header - -H "Content-Type:application/json" -X POST --data

         Response:
         HTTP/1.0 200 OK
         Date: Tue, 01 Nov 2011 11:30:59 GMT
         Server: WSGIServer/0.1 Python/2.7.1+
         Vary: Accept-Language, Cookie
         Content-Type: application/json
         Content-Language: en-us

         <?xml version="1.0" encoding="utf-8"?>
             <Response>
                 <Dial timeLimit="3600" callerId="650784355">
                     <Number gateways="user/,user" gatewayTimeouts="30000"></Number>
                 </Dial>
             </Response>



7.9 HangupcallResource

class api.resources.HangupcallResource(api_name=None)
      Attributes:
        •RequestUUID - RequestUUID
        •HangupCause - Hangup Cause



7.8. AnswercallResource                                                                         89
Newfies-Dialer Documentation, Release 1.1.0


     Create:
          CURL Usage:
          curl -u username:password --dump-header - -H "Content-Type:application/json" -X POST --data

          Response:
          HTTP/1.0 200 OK
          Date: Tue, 01 Nov 2011 12:04:35 GMT
          Server: WSGIServer/0.1 Python/2.7.1+
          Vary: Accept-Language, Cookie
          Content-Type: application/json
          Content-Language: en-us

          <?xml version="1.0" encoding="utf-8"?>
              <Response>
              </Response>



7.10 SurveyAppResource

class survey.api.resources.SurveyAppResource(api_name=None)
      Attributes:
         •name - survey name
         •description -
         •user_id - User ID
     Validation:
         •SurveyAppValidation()
     Create:
          CURL Usage:
          curl -u username:password --dump-header - -H "Content-Type:application/json" -X POST --data

          Response:
          HTTP/1.0 201 CREATED
          Date: Fri, 23 Sep 2011 06:08:34 GMT
          Server: WSGIServer/0.1 Python/2.7.1+
          Vary: Accept-Language, Cookie
          Content-Type: text/html; charset=utf-8
          Location: http://localhost:8000/api/v1/survey/1/
          Content-Language: en-us

     Read:
          CURL Usage:
          curl -u username:password -H ’Accept: application/json’ http://localhost:8000/api/v1/survey/

          Response:
          {
               "meta":{
                  "limit":20,



90                                                               Chapter 7. API Reference
Newfies-Dialer Documentation, Release 1.1.0



                "next":null,
                "offset":0,
                "previous":null,
                "total_count":1
              },
              "objects":[
                 {
                    "created_date":"2011-04-08T07:55:05",
                    "description":"This is default phone book",
                    "id":"1",
                    "name":"survey name",
                    "resource_uri":"/api/v1/survey/1/",
                    "updated_date":"2011-04-08T07:55:05",
                    "user":{
                       "first_name":"",
                       "id":"1",
                       "last_login":"2011-10-11T01:03:42",
                       "last_name":"",
                       "resource_uri":"/api/v1/user/1/",
                       "username":"areski"
                    }
                 }
              ]
         }

    Update:
         CURL Usage:
         curl -u username:password --dump-header - -H "Content-Type: application/json" -X PUT --data

         Response:
         HTTP/1.0 204 NO CONTENT
         Date: Fri, 23 Sep 2011 06:46:12 GMT
         Server: WSGIServer/0.1 Python/2.7.1+
         Vary: Accept-Language, Cookie
         Content-Length: 0
         Content-Type: text/html; charset=utf-8
         Content-Language: en-us

    Delete:
         CURL Usage:
         curl -u username:password --dump-header - -H "Content-Type: application/json" -X DELETE   htt

         curl -u username:password --dump-header - -H "Content-Type: application/json" -X DELETE   htt

         Response:
         HTTP/1.0 204 NO CONTENT
         Date: Fri, 23 Sep 2011 06:48:03 GMT
         Server: WSGIServer/0.1 Python/2.7.1+
         Vary: Accept-Language, Cookie
         Content-Length: 0
         Content-Type: text/html; charset=utf-8
         Content-Language: en-us




7.10. SurveyAppResource                                                                  91
Newfies-Dialer Documentation, Release 1.1.0



7.11 SurveyQuestionResource

class survey.api.resources.SurveyQuestionResource(api_name=None)
      Attributes:
         •question - survey question
         •user - User ID
         •surveyapp - surveyapp ID
         •audio_message - audio file
         •message_type - Audio / Text2Speech
     Validation:
         •SurveyQuestionValidation()
     Create:
          CURL Usage:
          curl -u username:password --dump-header - -H "Content-Type:application/json" -X POST --data

          Response:
          HTTP/1.0 201 CREATED
          Date: Fri, 23 Sep 2011 06:08:34 GMT
          Server: WSGIServer/0.1 Python/2.7.1+
          Vary: Accept-Language, Cookie
          Content-Type: text/html; charset=utf-8
          Location: http://localhost:8000/api/v1/survey_question/1/
          Content-Language: en-us

     Read:
          CURL Usage:
          curl -u username:password -H ’Accept: application/json’ http://localhost:8000/api/v1/survey_

          Response:
          {
               "meta":{
                 "limit":20,
                 "next":null,
                 "offset":0,
                 "previous":null,
                 "total_count":2
               },
               "objects":[
                  {
                     "created_date":"2011-12-15T13:10:49",
                     "id":"1",
                     "message_type":1,
                     "order":1,
                     "question":"Test Servey Qus",
                     "resource_uri":"/api/v1/survey_question/1/",
                     "surveyapp":{
                        "created_date":"2011-12-15T09:55:25",
                        "description":"",



92                                                                  Chapter 7. API Reference
Newfies-Dialer Documentation, Release 1.1.0



                         "id":"5",
                         "name":"new test",
                         "order":2,
                         "resource_uri":"/api/v1/survey/5/",
                         "updated_date":"2011-12-15T09:55:25",
                         "user":{
                            "first_name":"",
                            "id":"1",
                            "last_login":"2011-12-14T07:26:00",
                            "last_name":"",
                            "resource_uri":"/api/v1/user/1/",
                            "username":"areski"
                         }
                       },
                       "tags":"",
                       "updated_date":"2011-12-15T13:10:49",
                       "user":{
                          "first_name":"",
                          "id":"1",
                          "last_login":"2011-12-14T07:26:00",
                          "last_name":"",
                          "resource_uri":"/api/v1/user/1/",
                          "username":"areski"
                       }
                  },
              ]
         }

    Update:
         CURL Usage:
         curl -u username:password --dump-header - -H "Content-Type: application/json" -X PUT --data

         Response:
         HTTP/1.0 204 NO CONTENT
         Date: Fri, 23 Sep 2011 06:46:12 GMT
         Server: WSGIServer/0.1 Python/2.7.1+
         Vary: Accept-Language, Cookie
         Content-Length: 0
         Content-Type: text/html; charset=utf-8
         Content-Language: en-us

    Delete:
         CURL Usage:
         curl -u username:password --dump-header - -H "Content-Type: application/json" -X DELETE   htt

         curl -u username:password --dump-header - -H "Content-Type: application/json" -X DELETE   htt

         Response:
         HTTP/1.0 204 NO CONTENT
         Date: Fri, 23 Sep 2011 06:48:03 GMT
         Server: WSGIServer/0.1 Python/2.7.1+
         Vary: Accept-Language, Cookie
         Content-Length: 0




7.11. SurveyQuestionResource                                                              93
Newfies-Dialer Documentation, Release 1.1.0



          Content-Type: text/html; charset=utf-8
          Content-Language: en-us



7.12 SurveyResponseResource

class survey.api.resources.SurveyResponseResource(api_name=None)
      Attributes:
         •key - survey question’s response key
         •key value - response key value
         •surveyquestion - survey question ID
     Validation:
         •SurveyResponseValidation()
     Create:
          CURL Usage:
          curl -u username:password --dump-header - -H "Content-Type:application/json" -X POST --data

          Response:
          HTTP/1.0 201 CREATED
          Date: Fri, 23 Sep 2011 06:08:34 GMT
          Server: WSGIServer/0.1 Python/2.7.1+
          Vary: Accept-Language, Cookie
          Content-Type: text/html; charset=utf-8
          Location: http://localhost:8000/api/v1/survey_response/1/
          Content-Language: en-us

     Read:
          CURL Usage:
          curl -u username:password -H ’Accept: application/json’ http://localhost:8000/api/v1/survey_

          Response:
          {
               "meta":{
                  "limit":20,
                  "next":null,
                  "offset":0,
                  "previous":null,
                  "total_count":1
               },
               "objects":[
                  {
                     "created_date":"2011-12-15T14:54:50",
                     "id":"3",
                     "key":"YES",
                     "keyvalue":"1",
                     "resource_uri":"/api/v1/survey_response/3/",
                     "surveyquestion":{
                        "created_date":"2011-12-15T13:10:49",
                        "id":"17",


94                                                                  Chapter 7. API Reference
Newfies-Dialer Documentation, Release 1.1.0



                        "message_type":1,
                        "order":1,
                        "question":"Servey Qus",
                        "resource_uri":"/api/v1/survey_question/17/",
                        "surveyapp":{
                           "created_date":"2011-12-15T09:55:25",
                           "description":"",
                           "id":"5",
                           "name":"new test",
                           "order":2,
                           "resource_uri":"/api/v1/survey/5/",
                           "updated_date":"2011-12-15T14:45:46",
                           "user":{
                              "first_name":"",
                              "id":"1",
                              "last_login":"2011-12-14T07:26:00",
                              "last_name":"",
                              "resource_uri":"/api/v1/user/1/",
                              "username":"areski"
                           }
                        },
                        "tags":"",
                        "updated_date":"2011-12-15T13:10:49",
                        "user":{
                           "first_name":"",
                           "id":"1",
                           "last_login":"2011-12-14T07:26:00",
                           "last_name":"",
                           "resource_uri":"/api/v1/user/1/",
                           "username":"areski"
                        }
                      },
                      "updated_date":"2011-12-15T14:54:50"
                  }
              ]
         }

    Update:
         CURL Usage:
         curl -u username:password --dump-header - -H "Content-Type: application/json" -X PUT --data

         Response:
         HTTP/1.0 204 NO CONTENT
         Date: Fri, 23 Sep 2011 06:46:12 GMT
         Server: WSGIServer/0.1 Python/2.7.1+
         Vary: Accept-Language, Cookie
         Content-Length: 0
         Content-Type: text/html; charset=utf-8
         Content-Language: en-us

    Delete:
         CURL Usage:
         curl -u username:password --dump-header - -H "Content-Type: application/json" -X DELETE   htt

         curl -u username:password --dump-header - -H "Content-Type: application/json" -X DELETE   htt


7.12. SurveyResponseResource                                                              95
Newfies-Dialer Documentation, Release 1.1.0


         Response:
         HTTP/1.0 204 NO CONTENT
         Date: Fri, 23 Sep 2011 06:48:03 GMT
         Server: WSGIServer/0.1 Python/2.7.1+
         Vary: Accept-Language, Cookie
         Content-Length: 0
         Content-Type: text/html; charset=utf-8
         Content-Language: en-us




96                                                Chapter 7. API Reference
CHAPTER

                                                                                                          EIGHT



                                                                     CONTRIBUTING

     • Community Code of Conduct
     • Reporting a Bug
     • Coding Style




8.1 Community Code of Conduct

Members of our community need to work together effectively, and this code of conduct lays down the ground rules for
our cooperation.
Please read the following documentation about how the Newfies-Dialer Project functions, coding styles expected for
contributions, and the community standards we expect everyone to abide by.
The Code of Conduct is heavily based on the Ubuntu Code of Conduct, Celery Code of Conduct, and the Pylons Code
of Conduct.


8.1.1 Be considerate.

Your work will be used by other people, and you in turn will depend on the work of others. Any decision you take
will affect users and colleagues, and we expect you to take those consequences into account when making decisions.
Even if it’s not obvious at the time, our contributions to Newfies-Dialer will impact the work of others. For example,
changes to code, infrastructure, policy, documentation and translations during a release may negatively impact others
work.


8.1.2 Be respectful.

The Newfies-Dialer community and its members treat one another with respect. Everyone can make a valuable con-
tribution to Newfies-Dialer. We may not always agree, but disagreement is no excuse for poor behaviour and bad
manners. We might all experience some frustration now and then, but we cannot allow that frustration to turn into a
personal attack. It’s important to remember that a community where people feel uncomfortable or threatened is not
a productive one. We expect members of the Newfies-Dialer community to be respectful when dealing with other
contributors as well as with people outside the Newfies-Dialer project and with users of Newfies-Dialer.




                                                                                                                  97
Newfies-Dialer Documentation, Release 1.1.0


8.1.3 Be collaborative.

Collaboration is central to Newfies-Dialer and to the larger free software community. We should always be open to
collaboration. Your work should be done transparently and patches from Newfies-Dialer should be given back to the
community when they are made, not just when the distribution is released. If you wish to work on new code for
existing upstream projects, at least keep those projects informed of your ideas and progress. It many not be possible
to get consensus from upstream, or even from your colleagues about the correct implementation for an idea, so don’t
feel obliged to have that agreement before you begin, but at least keep the outside world informed of your work, and
publish your work in a way that allows outsiders to test, discuss and contribute to your efforts.


8.1.4 When you disagree, consult others.

Disagreements, both political and technical, happen all the time and the Newfies-Dialer community is no exception. It
is important that we resolve disagreements and differing views constructively and with the help of the community and
community process. If you really want to go a different way, then we encourage you to make a derivative distribution
or alternate set of packages that still build on the work we’ve done to utilise as common a core as possible.


8.1.5 When you are unsure, ask for help.

Nobody knows everything, and nobody is expected to be perfect. Asking questions avoids many problems down the
road, and so questions are encouraged. Those who are asked questions should be responsive and helpful. However,
when asking a question, care must be taken to do so in an appropriate forum.


8.1.6 Step down considerately.

Developers on every project come and go and Newfies-Dialer is no different. When you leave or disengage from the
project, in whole or in part, we ask that you do so in a way that minimises disruption to the project. This means you
should tell people you are leaving and take the proper steps to ensure that others can pick up where you leave off.


8.2 Reporting a Bug

Bugs can always be described to the Mailing list, but the best way to report an issue and to ensure a timely response is
to use the issue tracker.
     1. Create a GitHub account.
You need to create a GitHub account to be able to create new issues and participate in the discussion.
     2. Determine if your bug is really a bug.
You should not file a bug if you are requesting support. For that you can use the Mailing list.
     3. Make sure your bug hasn’t already been reported.
Search through the appropriate Issue tracker. If a bug like yours was found, check if you have new information that
could be reported to help the developers fix the bug.
     4. Collect information about the bug.
To have the best chance of having a bug fixed, we need to be able to easily reproduce the conditions that caused it.
Most of the time this information will be from a Python traceback message, though some bugs might be in design,
spelling or other errors on the website/docs/code.
If the error is from a Python traceback, include it in the bug report.


98                                                                                        Chapter 8. Contributing
Newfies-Dialer Documentation, Release 1.1.0


We also need to know what platform you’re running (Windows, OSX, Linux, etc), the version of your Python inter-
preter, the version of Newfies-Dialer and related packages that you were running when the bug occurred.
   5. Submit the bug.
By default GitHub will email you to let you know when new comments have been made on your bug. In the event
you’ve turned this feature off, you should check back on occasions to ensure you don’t miss any questions a developer
trying to fix the bug might ask.


8.2.1 Issue Trackers

Bugs for a package in the Newfies-Dialer ecosystem should be reported to the relevant issue tracker.
    • Newfies-Dialer: http://github.com/Star2Billing/newfies-dialer/issues/
    • Celery: https://github.com/ask/celery/issues/
    • Freeswitch: http://jira.freeswitch.org/secure/Dashboard.jspa
    • Plivo: https://github.com/plivo/plivo/issues/
If you are unsure of the origin of the bug you can ask the Mailing list, or just use the Newfies-Dialer issue tracker.


8.3 Coding Style

You should probably be able to pick up the coding style from surrounding code, but it is a good idea to be aware of the
following conventions.
    • All Python code must follow the PEP-8 guidelines.
pep8.py is a utility you can use to verify that your code is following the conventions.
    • Docstrings must follow the PEP-257 conventions, and use the following style.
            Do this:
            def method(self, arg):
                """Short description.

                  More details.

                  """

            or:
            def method(self, arg):
                """Short description."""

            but not this:
            def method(self, arg):
                """
                Short description.
                """

    • Lines should not exceed 78 columns.
    • Wildcard imports must not be used (from xxx import *).




8.3. Coding Style                                                                                                       99
Newfies-Dialer Documentation, Release 1.1.0




100                                          Chapter 8. Contributing
CHAPTER

                                                                                                            NINE



              FREQUENTLY ASKED QUESTIONS

     • General
     • Misconceptions




9.1 General

9.1.1 What is Newfies-Dialer?

Answer: .
Newfies-Dialer is a voice broadcast application designed and built to automate the delivery of interactive phone calls
to contacts, clients and the general public.


9.1.2 Why should I use Newfies-Dialer?

Answer: .
Below are some examples of some of the uses that Newfies-Dialer can be put to. There are more details and examples
at http://www.newfies-dialer.org/solutions/
    • Telecasting:
      Broadcast marketing or informational messages to customers and clients.

    • Telemarketing:
      Broadcast a marketing message to potential customers, and give them the option to be put through

    • Phone Polling, Surveys and Voting:
      Ring large numbers of people and present IVR options for either polling their opinions, interact

    • Debt Control:
      Customers can be automatically reminded at intervals that they owe money, and an IVR menu presen

    • Appointment reminders:
      Doctors, Dentists, and other organisations that make appointments for their clients can integrat




                                                                                                                101
Newfies-Dialer Documentation, Release 1.1.0


    • Dissemination of Information by Phone:
      Newfies-Dialer was originally designed to call large numbers of people and disseminate medical a

    • Mass Emergency Broadcasting:
      Where there is a necessity to warn large numbers of people in a short space of time, such as wea

    • Voice Conferencing:
      Attendees for a voice conference or podcast can be dialled up from a central location, and be co

    • Subscription Reminders and Renewals:
      Where a company sells an annual subscription for a product or service, Newfies-Dialer can be con



9.1.3 What’s the history behind Newfies-Dialer?

Answer: .
Newfies-Dialer is a bulk dialer application which was commissioned by a charity named Ku-
batana (http://www.kubatana.net) based in Zimbabwe, which sponsors the Freedomfone project
(http://www.freedomfone.org/) dedicated to providing information via phone technology.
In less economically developed countries, Internet is often limited, but there is usually comprehensive mobile phone
coverage. Freedomfone uses Newfies-Dialer to dial up people’s phones and offer health information on Cholera,
Malaria and so many other avoidable health issues in the third world, which may be alleviated by education. Newfies-
Dialer was so named after the Newfoundland Dog nicknamed Newfies and used by sea rescue services around the
world.


9.2 Misconceptions

9.2.1 Is Newfies-Dialer dependent on Celery?

Answer: Yes.




102                                                                 Chapter 9. Frequently Asked Questions
CHAPTER

                                                                                            TEN



                                                       TROUBLESHOOTING

     •   Where to find help
     •   Where to find the log files
     •   How to run a quick test call
     •   Run in debug mode
     •   Celerymon
     •   How to discard all pending tasks
     •   Checking Plivo is running
     •   Checking Freeswitch
     •   Step By Step Checklist




10.1 Where to find help

10.1.1 Documentation:

http://www.newfies-dialer.org/documentation/


10.1.2 Mailing list:

We have set up a mailing list at http://groups.google.com/group/newfies-dialer


10.1.3 Forum:

We have a forum at http://forum.newfies-dialer.org/


10.1.4 Support:

Star2Billing S.L. offers consultancy including installation, training and customisation


10.2 Where to find the log files

All the logs are centralized into one single directory /var/log/newfies/



                                                                                              103
Newfies-Dialer Documentation, Release 1.1.0


newfies-django-db.log : This contains all the Database queries performed by the UI
newfies-django.log : All the logger events from Django
err-apache-newfies.log : Any apache errors pertaining to Newfies-Dialer
celery-newfies-node1.log : This contains celery activity


10.3 How to run a quick test call

Go on the admin panel and check if there is any call request that has been spooled.
    • http://your-ip:8008/admin/dialer_cdr/callrequest/
If there are no calls queued, this means that the campaign is not properly configured.
You should:
   1. Check if the campaign is started that the “Start time”, “Finish Time” and server time are correct.
   2. Make sure that you configured a Dialer Setting for the user running the campaign, although there will be a
      warning for this on the Customer UI : http://your-ip:8008/admin/dialer_settings/dialersetting/
If there is an existing Call Request, check the status, and check the Celery log stored in /var/log/newfies


10.4 Run in debug mode

Make sure you stop the services first:
$ /etc/init.d/newfies-celeryd stop

Then run in debug mode:
$ workon newfies-dialer
$ cd /usr/share/newfies/
$ python manage.py celeryd -EB --loglevel=DEBUG



10.5 Celerymon

    • https://github.com/ask/celerymon
Running the monitor :
Start celery with the –events option on, so celery sends events for celerymon to capture:: $         workon   newfies-
      dialer $ cd /usr/share/newfies/ $ python manage.py celeryd -E
Run the monitor server:
$ workon newfies-dialer
$ cd /usr/share/newfies/
$ python manage.py celerymon

However, in production you probably want to run the monitor in the background, as a daemon:
$ workon newfies-dialer
$ cd /usr/share/newfies/
$ python manage.py celerymon --detach


104                                                                                   Chapter 10. Troubleshooting
Newfies-Dialer Documentation, Release 1.1.0


For a complete listing of the command line arguments available, with a short description, you can use the help com-
mand:
$ workon newfies-dialer
$ cd /usr/share/newfies/
$ python manage.py help celerymon

Now you can visit the webserver celerymon starts by going to: http://localhost:8989


10.6 How to discard all pending tasks

http://docs.celeryproject.org/en/latest/faq.html?highlight=purge#how-do-i-discard-all-waiting-tasks


10.7 Checking Plivo is running

At the command line, type:
$ ps aux | grep plivo

This should tell you that Plivo-rest, Plivo-Outbound and Plivo-cache are all running. If they are not, these services can
be restarted with the following commands:
$   /etc/init.d/plivo stop
$   /etc/init.d/plivocache stop
$   /etc/init.d/plivo start
$   /etc/init.d/plivocache start

If there are still issues with Plivo, then check the logs for clues at /usr/share/plivo/tmp/


10.8 Checking Freeswitch

Entering the Freeswitch CLI shold indicate whether it is running by typing fs_cli at the console. Once logged in, you
can check the trunk registration by typing sofia status at the Freeswitch CLI. CTRL-D exits the Freeswitch CLI.
If the Freeswitch CLI cannot be launched, then the status of freeswitch can be checked with:
$ ps aux | grep freeswitch
or
$ /etc/init.d/freeswitch status

If Freeswitch is not running, then it can be started with
$ /etc/init.d/freeswitch start



10.9 Step By Step Checklist

The step by step checklist below should be used to validate that all components of the platform are running.
User interface :
     •   1. Dialer Gateway matching a configured trunk is set up in the UI



10.6. How to discard all pending tasks                                                                              105
Newfies-Dialer Documentation, Release 1.1.0


    •   2. Dialer Settings configured and attached to the appropriate user
    •   3. Phonebook Created with contacts attached to the phonebook
    •   4. Configured voice application
    •   5. Campaign created, and started, with a phone book attached, and the campaign schedule current
Backend :
    •   1. Celery Monitor Running
    •   2. Plivo Running
    •   3. Freeswitch running
If there are still problems, then raise a support question on the mailing-list http://groups.google.com/group/newfies-
dialer or our forum, http://forum.newfies-dialer.org/, alternatively, contact newfies-dialer@star2billing.com for com-
mercial support.




106                                                                               Chapter 10. Troubleshooting
CHAPTER

                                                                                                     ELEVEN



                                                                             RESOURCES

     • Getting Help
          – Mailing list
     • Bug tracker
     • Wiki
     • Contributing
     • License



11.1 Getting Help

11.1.1 Mailing list

For discussions about the usage, development, and future of Newfies-Dialer, please join the Newfies-Dialer mailing
list.


11.2 Bug tracker

If you have any suggestions, bug reports or annoyances please report them to our issue tracker at
https://github.com/Star2Billing/newfies-dialer/issues/


11.3 Wiki

https://github.com/Star2Billing/newfies-dialer/wiki/


11.4 Contributing

Development of Newfies-Dialer happens at Github: https://github.com/Star2Billing/newfies-dialer
You are highly encouraged to participate in the development of Newfies-Dialer. If you would prefer not to use Github,
you are welcome to send us regular patches
Be sure to also read the Contributing section in the documentation.



                                                                                                               107
Newfies-Dialer Documentation, Release 1.1.0



11.5 License

This software is licensed under the AGPL License. See the LICENSE file in the top distribution directory for the full
license text.




108                                                                                     Chapter 11. Resources
CHAPTER

                           TWELVE



             INDICES AND TABLES

• genindex
• modindex
• search




                                109
Newfies-Dialer Documentation, Release 1.1.0




110                                          Chapter 12. Indices and tables
PYTHON MODULE INDEX


a
api.resources, 83

d
dialer_campaign.admin, 71
dialer_campaign.models, 74
dialer_campaign.tasks, 73
dialer_campaign.views, 66
dialer_cdr.admin, 72
dialer_cdr.models, 63
dialer_cdr.tests, 75
dialer_gateway.admin, 73
dialer_gateway.models, 64
dialer_settings.admin, 73
dialer_settings.models, 65

s
survey.api.resources, 94

u
user_profile.models, 65




                                              111
Newfies-Dialer Documentation, Release 1.1.0




112                                          Python Module Index
INDEX


A                                                             changelist_view()       (dialer_cdr.admin.VoIPCallAdmin
add_view()     (dialer_campaign.admin.CampaignAdmin                     method), 72
          method), 71                                         changelist_view() (dialer_settings.admin.DialerSettingAdmin
add_view()        (dialer_campaign.admin.ContactAdmin                   method), 73
          method), 72                                         check_campaign_pendingcall            (class     in     di-
add_view() (dialer_settings.admin.DialerSettingAdmin                    aler_campaign.tasks), 73
          method), 73                                         collect_subscriber (class in dialer_campaign.tasks), 74
AnswercallResource (class in api.resources), 89               common_campaign_status()           (in       module     di-
api.resources (module), 79, 82, 83, 85, 86, 88, 89                      aler_campaign.views), 68
                                                              common_send_notification()           (in      module     di-
B                                                                       aler_campaign.views), 67
                                                              Contact (class in dialer_campaign.models), 60
BulkContactResource (class in api.resources), 85
                                                              contact_add() (in module dialer_campaign.views), 69
                                                              contact_change() (in module dialer_campaign.views), 70
C                                                             contact_grid() (in module dialer_campaign.views), 69
Callrequest (class in dialer_cdr.models), 63                  contact_import() (in module dialer_campaign.views), 70
callrequest_pending (class in dialer_cdr.tasks), 74           contact_list() (in module dialer_campaign.views), 69
CallrequestAdmin (class in dialer_cdr.admin), 72              contact_name()           (dialer_campaign.models.Contact
CallrequestResource (class in api.resources), 86                        method), 61
Campaign (class in dialer_campaign.models), 61                ContactAdmin (class in dialer_campaign.admin), 72
campaign_add() (in module dialer_campaign.views), 71          count_contact_of_phonebook()                           (di-
campaign_change() (in module dialer_campaign.views),                    aler_campaign.models.Campaign            method),
          71                                                            62
campaign_grid() (in module dialer_campaign.views), 70         cust_password_reset()          (in         module       di-
campaign_list() (in module dialer_campaign.views), 70                   aler_campaign.views), 67
campaign_running (class in dialer_campaign.tasks), 73         cust_password_reset_confirm()          (in     module    di-
CampaignAdmin (class in dialer_campaign.admin), 71                      aler_campaign.views), 67
CampaignDeleteCascadeResource              (class        in   cust_password_reset_done()         (in       module     di-
          api.resources), 83                                            aler_campaign.views), 67
CampaignManager (class in dialer_campaign.models), 61         customer_dashboard()           (in         module       di-
CampaignResource (class in api.resources), 79                           aler_campaign.views), 66
CampaignSubscriber (class in dialer_campaign.models),
          62                                                  D
campaignsubscriber_detail()                            (di-   destination_name()            (dialer_cdr.models.VoIPCall
          aler_campaign.models.Campaign            method),             method), 64
          62                                                  dialer_campaign.admin (module), 71
CampaignSubscriberAdmin            (class       in      di-   dialer_campaign.models (module), 60, 74
          aler_campaign.admin), 72                            dialer_campaign.tasks (module), 73
CampaignSubscriberResource (class in api.resources), 85       dialer_campaign.views (module), 66
CdrResource (class in api.resources), 88                      dialer_cdr.admin (module), 72
change_view() (dialer_settings.admin.DialerSettingAdmin       dialer_cdr.models (module), 63
          method), 73                                         dialer_cdr.tests (module), 75


                                                                                                                  113
Newfies-Dialer Documentation, Release 1.1.0


dialer_gateway.admin (module), 73                         N
dialer_gateway.models (module), 64                   NewfiesAdminInterfaceTestCase     (class    in      di-
dialer_settings.admin (module), 73                          aler_cdr.tests), 76
dialer_settings.models (module), 65                  NewfiesCustomerInterfaceForgotPassTestCase (class in
DialerSetting (class in dialer_settings.models), 65         dialer_cdr.tests), 77
DialerSettingAdmin (class in dialer_settings.admin), 73
                                                     NewfiesCustomerInterfaceTestCase    (class   in     di-
                                                            aler_cdr.tests), 76
E                                                    NewfiesTastypieApiTestCase (class in dialer_cdr.tests),
export_voip_report() (dialer_cdr.admin.VoIPCallAdmin        75
         method), 73
                                                          P
G                                                         Phonebook (class in dialer_campaign.models), 60
Gateway (class in dialer_gateway.models), 64              phonebook_add() (in module dialer_campaign.views), 68
GatewayAdmin (class in dialer_gateway.admin), 73          phonebook_change() (in module dialer_campaign.views),
get_active_callmaxduration()                      (di-             69
          aler_campaign.models.Campaign       method),    phonebook_contacts()                               (di-
          62                                                       aler_campaign.models.Phonebook        method),
get_active_contact() (dialer_campaign.models.Campaign              60
          method), 62                                     phonebook_grid() (in module dialer_campaign.views), 68
get_active_contact_no_subscriber()                (di-    phonebook_list() (in module dialer_campaign.views), 68
          aler_campaign.models.Campaign       method),    PhonebookAdmin (class in dialer_campaign.admin), 71
          62                                              PhonebookResource (class in api.resources), 83
get_active_max_frequency()                        (di-    post_save_add_contact()        (in     module       di-
          aler_campaign.models.Campaign       method),             aler_campaign.models), 74
          62                                              progress_bar()       (dialer_campaign.models.Campaign
get_expired_campaign()                            (di-             method), 62
          aler_campaign.models.CampaignManager
          method), 61                                     S
get_pending_subscriber()                          (di-    setUp() (dialer_cdr.tests.NewfiesAdminInterfaceTestCase
          aler_campaign.models.Campaign       method),              method), 76
          62                                              survey.api.resources (module), 90, 91, 94
get_running_campaign()                            (di-    SurveyAppResource (class in survey.api.resources), 90
          aler_campaign.models.CampaignManager            SurveyQuestionResource (class in survey.api.resources),
          method), 61                                               92
                                                          SurveyResponseResource (class in survey.api.resources),
H                                                                   94
HangupcallResource (class in api.resources), 89
has_add_permission() (dialer_cdr.admin.VoIPCallAdmin T
           method), 73                                    test_admin_index()                                 (di-
                                                                    aler_cdr.tests.NewfiesAdminInterfaceTestCase
I                                                                   method), 76
import_contact() (dialer_campaign.admin.ContactAdmin test_admin_newfies()                                     (di-
           method), 72                                              aler_cdr.tests.NewfiesAdminInterfaceTestCase
index() (in module dialer_campaign.views), 66                       method), 76
init_callrequest (class in dialer_cdr.tasks), 74          test_campaign_view()                               (di-
is_authorized_contact()                              (di-           aler_cdr.tests.NewfiesCustomerInterfaceTestCase
           aler_campaign.models.Campaign         method),           method), 76
           62                                             test_check_password_reset()                        (di-
                                                                    aler_cdr.tests.NewfiesCustomerInterfaceForgotPassTestCase
L                                                                   method), 77
login_view() (in module dialer_campaign.views), 67        test_contact_view()                                (di-
                                                                    aler_cdr.tests.NewfiesCustomerInterfaceTestCase
M                                                                   method), 77
min_duration() (dialer_cdr.models.VoIPCall method), 64


114                                                                                                       Index
Newfies-Dialer Documentation, Release 1.1.0


test_create_answercall()                             (di- test_read_phonebook()                               (di-
          aler_cdr.tests.NewfiesTastypieApiTestCase                  aler_cdr.tests.NewfiesTastypieApiTestCase
          method), 75                                               method), 76
test_create_bulk_contact()                           (di- test_read_survey() (dialer_cdr.tests.NewfiesTastypieApiTestCase
          aler_cdr.tests.NewfiesTastypieApiTestCase                  method), 76
          method), 75                                     test_read_survey_question()                         (di-
test_create_callrequest()                            (di-           aler_cdr.tests.NewfiesTastypieApiTestCase
          aler_cdr.tests.NewfiesTastypieApiTestCase                  method), 76
          method), 75                                     test_read_survey_response()                         (di-
test_create_campaign()                               (di-           aler_cdr.tests.NewfiesTastypieApiTestCase
          aler_cdr.tests.NewfiesTastypieApiTestCase                  method), 76
          method), 75                                     test_survey_view()                                  (di-
test_create_campaign_subscriber()                    (di-           aler_cdr.tests.NewfiesCustomerInterfaceTestCase
          aler_cdr.tests.NewfiesTastypieApiTestCase                  method), 77
          method), 75                                     test_update_campaign()                              (di-
test_create_cdr() (dialer_cdr.tests.NewfiesTastypieApiTestCase       aler_cdr.tests.NewfiesTastypieApiTestCase
          method), 75                                               method), 76
test_create_hangupcall()                             (di- test_update_campaign_subscriber()                   (di-
          aler_cdr.tests.NewfiesTastypieApiTestCase                  aler_cdr.tests.NewfiesTastypieApiTestCase
          method), 75                                               method), 76
test_create_phonebook()                              (di- test_update_survey()                                (di-
          aler_cdr.tests.NewfiesTastypieApiTestCase                  aler_cdr.tests.NewfiesTastypieApiTestCase
          method), 75                                               method), 76
test_create_survey()                                 (di- test_update_survey_question()                       (di-
          aler_cdr.tests.NewfiesTastypieApiTestCase                  aler_cdr.tests.NewfiesTastypieApiTestCase
          method), 75                                               method), 76
test_create_survey_question()                        (di- test_update_survey_response()                       (di-
          aler_cdr.tests.NewfiesTastypieApiTestCase                  aler_cdr.tests.NewfiesTastypieApiTestCase
          method), 75                                               method), 76
test_create_survey_response()                        (di- test_user_settings()                                (di-
          aler_cdr.tests.NewfiesTastypieApiTestCase                  aler_cdr.tests.NewfiesCustomerInterfaceTestCase
          method), 75                                               method), 77
test_dashboard() (dialer_cdr.tests.NewfiesCustomerInterfaceTestCase
                                                          test_voiceapp_view()                                (di-
          method), 77                                               aler_cdr.tests.NewfiesCustomerInterfaceTestCase
test_delete_campaign()                               (di-           method), 77
          aler_cdr.tests.NewfiesTastypieApiTestCase        test_voip_call_report()                             (di-
          method), 75                                               aler_cdr.tests.NewfiesCustomerInterfaceTestCase
test_delete_cascade_campaign()                       (di-           method), 77
          aler_cdr.tests.NewfiesTastypieApiTestCase
          method), 76                                     U
test_index() (dialer_cdr.tests.NewfiesCustomerInterfaceTestCase
                                                          update_campaign_status()                            (di-
          method), 77                                               aler_campaign.models.Campaign         method),
test_phonebook_view()                                (di-           62
          aler_cdr.tests.NewfiesCustomerInterfaceTestCase used_gateway_link() (dialer_cdr.admin.VoIPCallAdmin
          method), 77                                               method), 73
test_read_callrequest()                              (di- user_link() (dialer_cdr.admin.VoIPCallAdmin method),
          aler_cdr.tests.NewfiesTastypieApiTestCase                  73
          method), 76                                     user_profile.models (module), 65
test_read_campaign()                                 (di- UserProfile (class in user_profile.models), 65
          aler_cdr.tests.NewfiesTastypieApiTestCase
          method), 76                                     V
test_read_campaign_subscriber()                      (di- VoIPCall (class in dialer_cdr.models), 63
          aler_cdr.tests.NewfiesTastypieApiTestCase        VoIPCallAdmin (class in dialer_cdr.admin), 72
          method), 76


Index                                                                                                       115

More Related Content

PDF
Newfies dialer Auto dialer Software
PDF
Dns320 manual 100
PDF
J series-chassis-cluster-setup
PDF
Plesk 8.1 for Windows
PDF
2 x applicationserver
PDF
Reseller's Guide
Newfies dialer Auto dialer Software
Dns320 manual 100
J series-chassis-cluster-setup
Plesk 8.1 for Windows
2 x applicationserver
Reseller's Guide

What's hot (19)

PDF
Ls9208 prg
PDF
Plesk 8.1 for Linux/UNIX
PDF
Cluster in linux
PDF
Managing Data Center Connectivity TechBook
 
PDF
Cluster administration rh
PDF
0802 python-tutorial
PDF
Tutorial edit
PDF
SEAMLESS MPLS
PDF
Creating a VMware Software-Defined Data Center Reference Architecture
 
PDF
CALM DURING THE STORM:Best Practices in Multicast Security
PDF
Zend framework tutorial
PDF
Faronics Deep Freeze Enterprise User Guide
PDF
Smart dsp os_user_guide
PDF
PDF
Zeta Producer 9 CMS online manual
PDF
CONTINUOUS SYSTEMS, NONSTOP OPERATIONS WITH JUNOS
PDF
Load runner controller
PDF
Getting started-with-lotus-suspension-analysis
Ls9208 prg
Plesk 8.1 for Linux/UNIX
Cluster in linux
Managing Data Center Connectivity TechBook
 
Cluster administration rh
0802 python-tutorial
Tutorial edit
SEAMLESS MPLS
Creating a VMware Software-Defined Data Center Reference Architecture
 
CALM DURING THE STORM:Best Practices in Multicast Security
Zend framework tutorial
Faronics Deep Freeze Enterprise User Guide
Smart dsp os_user_guide
Zeta Producer 9 CMS online manual
CONTINUOUS SYSTEMS, NONSTOP OPERATIONS WITH JUNOS
Load runner controller
Getting started-with-lotus-suspension-analysis
Ad

Similar to Newfies-Dialer : Autodialer software - Documentation version 1.1.0 (20)

PDF
PDF
PDF
Certification guide series ibm tivoli usage and accounting manager v7.1 imple...
PDF
Da package usersguide
PDF
Manual doctrine jog
PDF
Odoo development
PDF
LSI_SAS2008_Manual_v100.pdf
PDF
Apache Maven
PDF
A practical guide to tivoli sa nergy sg246146
PDF
Momentus pm
PDF
Flask docs
PDF
Phasor series operating_manual
PDF
Selenium documentation,
PDF
Cimco edit 5 user guide[1]
PDF
Maven definitive guide
PDF
Sg247692 Websphere Accounting Chargeback For Tuam Guide
PDF
zend framework 2
PDF
Mod security 3 NGINX
PDF
spring-security-reference.pdf
Certification guide series ibm tivoli usage and accounting manager v7.1 imple...
Da package usersguide
Manual doctrine jog
Odoo development
LSI_SAS2008_Manual_v100.pdf
Apache Maven
A practical guide to tivoli sa nergy sg246146
Momentus pm
Flask docs
Phasor series operating_manual
Selenium documentation,
Cimco edit 5 user guide[1]
Maven definitive guide
Sg247692 Websphere Accounting Chargeback For Tuam Guide
zend framework 2
Mod security 3 NGINX
spring-security-reference.pdf
Ad

More from Areski Belaid (10)

PDF
Whitepaper newfies-dialer Autodialer
PDF
Newfies dialer Brief Introduction
PDF
Nikola, a static blog & site generator python meetup 19 feb2014
PDF
Flask Introduction - Python Meetup
PDF
Newfies dialer - autodialer : freeswitch weekly conference 13 march2013
PDF
Introduction to IPython & Notebook
PDF
CDR-Stats : VoIP Analytics Solution for Asterisk and FreeSWITCH with MongoDB
PDF
Newfies dialer : freeswitch weekly conference
ODP
A2Billing : Turning VoIP into Business
PDF
A2Billing : Turning VoIP into business
Whitepaper newfies-dialer Autodialer
Newfies dialer Brief Introduction
Nikola, a static blog & site generator python meetup 19 feb2014
Flask Introduction - Python Meetup
Newfies dialer - autodialer : freeswitch weekly conference 13 march2013
Introduction to IPython & Notebook
CDR-Stats : VoIP Analytics Solution for Asterisk and FreeSWITCH with MongoDB
Newfies dialer : freeswitch weekly conference
A2Billing : Turning VoIP into Business
A2Billing : Turning VoIP into business

Newfies-Dialer : Autodialer software - Documentation version 1.1.0

  • 1. Newfies-Dialer Documentation Release 1.1.0 Arezqui Belaid January 16, 2012
  • 3. CONTENTS 1 Getting Started 3 1.1 Introduction . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3 2 Installation 7 2.1 Installation overview . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 7 2.2 Broker Installation . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 9 2.3 Celery Installation . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 11 3 User Guide 13 3.1 Overview . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 13 3.2 How to use Newfies-Dialer . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 13 3.3 Admin Panel . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 23 3.4 Customer Panel . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 35 4 Configuration and Defaults 49 4.1 Sample Configuration . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 49 4.2 Celery Configuration . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 52 5 FreeSwitch Installation and Configuration 55 5.1 Freeswitch Installation and configuration . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 55 5.2 Plivo Installation and configuration . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 55 5.3 Freeswitch Trunk configuration . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 56 6 Developer doc 59 6.1 Prerequisites . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 59 6.2 Coding Style & Structure . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 59 6.3 Objects Description . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 60 6.4 Database Design . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 66 6.5 Newfies-Dialer Views . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 66 6.6 Newfies-Dialer Admin Views . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 71 6.7 Newfies Tasks . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 73 6.8 Newfies Signals . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 74 6.9 Test Case Descriptions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 74 7 API Reference 79 7.1 CampaignResource . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 79 7.2 CampaignDeleteCascadeResource . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 83 7.3 PhonebookResource . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 83 7.4 BulkContactResource . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 85 7.5 CampaignSubscriberResource . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 85 i
  • 4. 7.6 CallrequestResource . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 86 7.7 CdrResource . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 88 7.8 AnswercallResource . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 89 7.9 HangupcallResource . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 89 7.10 SurveyAppResource . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 90 7.11 SurveyQuestionResource . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 92 7.12 SurveyResponseResource . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 94 8 Contributing 97 8.1 Community Code of Conduct . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 97 8.2 Reporting a Bug . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 98 8.3 Coding Style . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 99 9 Frequently Asked Questions 101 9.1 General . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 101 9.2 Misconceptions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 102 10 Troubleshooting 103 10.1 Where to find help . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 103 10.2 Where to find the log files . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 103 10.3 How to run a quick test call . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 104 10.4 Run in debug mode . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 104 10.5 Celerymon . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 104 10.6 How to discard all pending tasks . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 105 10.7 Checking Plivo is running . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 105 10.8 Checking Freeswitch . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 105 10.9 Step By Step Checklist . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 105 11 Resources 107 11.1 Getting Help . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 107 11.2 Bug tracker . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 107 11.3 Wiki . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 107 11.4 Contributing . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 107 11.5 License . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 108 12 Indices and tables 109 Python Module Index 111 Index 113 ii
  • 5. Newfies-Dialer Documentation, Release 1.1.0 Version 1.1 Release 1.1.0 Date January 16, 2012 Contents: CONTENTS 1
  • 7. CHAPTER ONE GETTING STARTED Contents: 1.1 Introduction Web http://www.newfies-dialer.org/ Download http://www.newfies-dialer.org/download/ Source https://github.com/Star2Billing/newfies-dialer/ Keywords dialer, voip, freeswitch, django, asynchronous, rabbitmq, redis, python, distributed – Newfies is an open source VoIP Dialer based on distributed message passing. It has been built to support cloud based servers and can also work on standalone servers. It uses Freeswitch (VoIP Server) to outbound calls, but support for other VoIP Servers such as Asterisk could be easily added in the future. The platform is focused on real-time operations and task call distributions to clustered brokers and workers. Newfies-Dialer is written in Python, using the Django Framework. It also operates with message brokers such as RabbitMQ, Redis but support for Beanstalk, MongoDB, CouchDB and DBMS is also available. Newfies-Dialer provides an extensive set of APIs to easily integrate with third-party applications. Using very simple steps, Newfies-Dialer will help you create campaigns, add phonebooks, contacts, build audio mes- sages and create complex telephony applications. Once your campaigns are ready to start, your messages will be dispatched and delivered. • Overview • Utility • Features • Architecture • Latest documentation 1.1.1 Overview Newfies-Dialer can be installed and used by anyone who has a need for mass outbound calling, voice broadcasting or providing outbound IVR. Some of the potential uses for Newfies-Dialer are listed below. The system may be installed and used by either companies who wish to make calls on their own behalf, or by SaaS (Software as a Service) companies that want to provide bulk dialling facilities to their own customers. 3
  • 8. Newfies-Dialer Documentation, Release 1.1.0 1.1.2 Utility Newfies-Dialer is loaded up with a list of telephone numbers that can be dialled sequentially at very high rates of calling depending on carrier capacity and hardware, potentially delivering many millions of calls per day. When the called party answers the call, Newfies-Dialer passes the call to a telephony application that is custom designed to provide the desired behaviour. Below are examples of some of the uses for Newfies-Dialer • Telecasting: Broadcast marketing or informational messages to customers and clients. • Telemarketing: Broadcast a marketing message to potential customers, and give them the option to be put through to a call-centre via an IVR (Interactive Voice Response) Menu. • Phone Polling, Surveys and Voting: Ring large numbers of people and present IVR options for either polling their opinions, interactive surveys, or taking their vote and record the results. • Debt Control: Customers can be automatically reminded at intervals that they owe money, and an IVR menu presented to talk to the finance department or passed to a credit card capture IVR to pay over the phone. • Appointment reminders: Doctors, Dentists, and other organisations that make appointments for their clients can integrate Newfies-Dialer into their appointment systems to pass a message reminding them of an upcoming appointment. • Dissemination of information via phone: Newfies-Dialer was originally designed to call large numbers of people and disseminate medical and health advice via the ubiquitous cellphone in 3rd world countries where often, literacy levels are low. On a local scale, it can be used to disseminate information about forthcoming community events. • Mass Emergency broadcast: Where there is a necessity to warn large numbers of people in a short space of time, such as weather warnings. • Voice Conferencing: Attendees for a voice conference or podcast can be dialled up from a central loca- tion, and be connected in an audio conference room. • Subscription Reminders and Renewals: Where a company sells an annual subscription for a prod- uct or service, Newfies-Dialer can be configured to dial the customer, remind them that the subscription is due, and optionally pass the call into a call centre or into a credit card payment IVR. 4 Chapter 1. Getting Started
  • 9. Newfies-Dialer Documentation, Release 1.1.0 1.1.3 Features Tele- Based on leading open source Freeswitch, Asterisk phony PBX Dis- Runs on one or more machines. Supports broker clustering and HA when used in tributed combination with RabbitMQ. You can set up new workers without central configuration (e.g. use your grandma’s laptop to help if the queue is temporarily congested). Concur- Throttle Concurrent Calls rency Schedul- Supports recurring tasks like cron, or specifying an exact date or countdown for when the ing task should be executed. Can re-try to the non connected numbers at a later time IVR Accommodates multiple IVR scripts with options to connect the user to some other support IVR/phone number on pressing a key Web In- Newfies can be managed via a Web interface. Realtime web-based reports for call details terface and current calls. You can query status and results via URLs, enabling the ability to poll task status using Ajax. Error Can be configured to send emails to the administrator if a tasks fails. Emails Import Import contact details from a .csv file Contact 1.1.4 Architecture • User selects contacts, phonebooks and campaigns, then chooses a voice application to use. The campaign is then launched • Newfies-Dialer spools the outbound calls to FreeSWITCH via Plivo. • Plivo sends the dial request to FreeSWITCH using the event socket. • FreeSWITCH dials the contact via the configured telephony gateways. • Contact picks up the call, and the answer event is received in FreeSWITCH and passed back to Plivo. • Newfies-Dialer is notified that the call is answered, then renders & relays RestXML to Plivo. • Plivo interprets RestXML and sends the application call-flow commands to FreeSWITCH. • The voice application is delivered to the contact by FreeSWITCH. 1.1. Introduction 5
  • 10. Newfies-Dialer Documentation, Release 1.1.0 1.1.5 Latest documentation The latest documentation with user guides, tutorials and API reference is hosted at “Readthedocs”. 6 Chapter 1. Getting Started
  • 11. CHAPTER TWO INSTALLATION Contents: 2.1 Installation overview 2.1.1 Install requirements A Requirements file gives you a way to create an environment where you can put all optional dependencies which are needed for your Project/Application. To get started with Newfies-Dialer you must have the following installed: • python >= 2.4 (programming language) • Apache / http server with WSGI modules • Django Framework >= 1.3 (Python based Web framework) • Celery >= 2.2 (Asynchronous task queue/job queue based on distributed message passing) • MySQL-python >= 1.2.3 (MySQL for python language) • Werkzeug >= 0.6.2 (Collection of various utilities for WSGI applications) • amqplib >= 0.6.1 (Client library for AMQP) • anyjson >= 0.3 (Loads the fastest JSON module) • django-celery >= 2.2.4 (Celery integration for Django) • django-extensions >= 0.6 (Collection of global custom management extensions for Django) • django-jsonfield >= 0.6 (Reusable django field that can use inside models) • django-pagination >= 1.0.7 (Utilities for creating robust pagination tools throughout a django application) • django-picklefield >= 0.1.9 (Implementation of a pickled object field) • django-threaded-multihost >= 1.4-0 (Provides multi-host utilities to Django projects) • django-urlauth = 0.1.1 (Allows to build links with authentication effect ) • django-uuidfield >= 0.2 (Provides a UUIDField for your Django models) • django-reusableapps >= 0.1.1 (Python module to enable Django to load reusable, pluggable and egg-based applications) • docutils >= 0.7 (Text processing system for processing plaintext documentation into useful formats) 7
  • 12. Newfies-Dialer Documentation, Release 1.1.0 • importlib >= 1.0.2 (Implementation of the import statement) • kombu >= 1.0.2 (An AMQP - Advanced Message Queuing Protocol messaging framework for Python) • pyparsing >= 1.5.5 (A general parsing module for Python) • python-dateutil >= 1.5 (Extensions to the standard datetime module) • redis >= 2.2.2 (Redis Python Client) • simplejson >= 2.1.3 (Simple, fast, complete, correct and extensible JSON) • uuid >= 1.30 (UUID object and generation functions ) • wsgiref >= 0.1.2 (Validation support for WSGI ) • switch2bill-common (Common library that are reused by Star2Billing) • simu-prefix-country (Provide Prefix and Country information) • django-tastypie (Creating delicious APIs for Django) • BeautifulSoup >= 3.2.0 (HTML parser optimized for screen-scraping) • Pygments >= 1.4 (A generic syntax highlighter) • django-admin-tools (Collection of tools for the django administration) • python-memcached >= 1.47 (Python based API for communicating with the memcached distributed memory object cache daemon) • django-memcache-status >= 1.0.1 (Displays statistics about memcached instances) • django-notification >= 0.1.3 (User notification management for the Django web framework) • identicon (identicon python implementation) • django-sentry >= 1.8.6.2 (Real-time logging / error tracing for Django) • django-qsstats >= 0.3.1 (A django microframework that eases the generation of aggregate data for querysets) Use PIP to install all the requirements,: $ pip install -r requirements.txt 2.1.2 Installation Script You can install Newfies-Dialer manually or using the shell script provided. To install Newfies-Dialer using the script,: $ chmod +x install/install-newfies.sh $ ./install/install-newfies.sh $ chmod +x install/install-celery.sh $ ./install/install-celery.sh 2.1.3 Running a Newfies-Dialer Inside Newfies-Dialer directory you should run: 8 Chapter 2. Installation
  • 13. Newfies-Dialer Documentation, Release 1.1.0 $ mkdir database $ python manage.py syncdb $ python manage.py collectstatic $ python manage.py runserver syncdb will create a database named test.db in database folder of the Newfies-Dialer directory. We have con- figured Newfies-Dialer to do this, but you can change this simply by modifying settings.py where DATABASES dictionary is constructed. You can find more information about this in the Django documentation. collectstatic will fetch all necessary media files and put them into static folder defined in the settings module. runserver runs an embedded webserver to test your site. By default it will run on http://localhost:8000. This is configurable and more information can be found on runserver in Django documentation. 2.1.4 Caching System When a User requests a page, the Web server makes calculations for business logic and to create the page that your visitor sees. It creates a processing overhead higher than a standard read-a-file-off-the-filesystem server arrangement. This is where caching comes in. To cache something is to save the result of an expensive calculation so that you don’t have to perform the calculation next time. $ mkdir /usr/share/django_cache 2.2 Broker Installation This document describes the installation of two different Brokers. One is Redis and second is Rabbitmq. You can install either to work with Newfies-Dialer. 2.2.1 Redis Download Source Download : redis-server_2.0.0~rc2-1_amd64.deb. To install Redis-Server $ sudo dpkg -i redis-server_2.0.0~rc2-1_amd64.deb or you can use apt-get $ apt-get install redis-server 2.2. Broker Installation 9
  • 14. Newfies-Dialer Documentation, Release 1.1.0 Running Server $ redis-server 2.2.2 Rabbitmq RabbitMQ is a complex and sophisticated product. If you don’t need this level of robustness, then you might want to take a look at Redis - it installs easily, runs relatively lean, and can be monitored and maintained without a lot of fuss. See Installing RabbitMQ over at RabbitMQ’s website. Note: If you’re getting nodedown errors after installing and using rabbitmqctl then this blog post can help you identify the source of the problem: http://somic.org/2009/02/19/on-rabbitmqctl-and-badrpcnodedown/ Download Source http://www.rabbitmq.com/server.html Debian APT repository To make use of the RabbitMQ APT repository, 1. Add the following line to your /etc/apt/sources.list deb http://www.rabbitmq.com/debian/ testing main Note: The word testing in the above line refers to the state of the release of RabbitMQ, not any particular Debian distribution. You can use it with Debian stable, testing or unstable, as well as with Ubuntu. In the future there will be a stable release of RabbitMQ in the repository. 2. (optional) To avoid warnings about unsigned packages, add RabbitMQ’s public key to your trusted key list using apt-key(8) $ wget http://www.rabbitmq.com/rabbitmq-signing-key-public.asc $ sudo apt-key add rabbitmq-signing-key-public.asc 3. Run apt-get update. 4. Install packages as usual; for instance, $ sudo apt-get install rabbitmq-server Setting up RabbitMQ To use celery we need to create a RabbitMQ user, a virtual host and allow that user access to that virtual host: 10 Chapter 2. Installation
  • 15. Newfies-Dialer Documentation, Release 1.1.0 $ rabbitmqctl add_user myuser mypassword $ rabbitmqctl add_vhost myvhost $ rabbitmqctl set_permissions -p myvhost myuser ".*" ".*" ".*" See the RabbitMQ Admin Guide for more information about access control. Starting/Stopping the RabbitMQ server To start the server: $ sudo rabbitmq-server you can also run it in the background by adding the -detached option (note: only one dash): $ sudo rabbitmq-server -detached Never use kill to stop the RabbitMQ server, but rather use the rabbitmqctl command: $ sudo rabbitmqctl stop When the server is running, you can continue reading Setting up RabbitMQ. 2.3 Celery Installation 2.3.1 Celery Celery is an asynchronous task queue/job queue based on distributed message passing. It is focused on real-time operation, but supports scheduling as well. You can install Celery either via the Python Package Index (PyPI) or from source. To install using pip $ pip install Celery To install using easy_install $ easy_install Celery Downloading and installing from source To Download the latest version click here. You can install it by doing the following: $ tar xvfz celery-0.0.0.tar.gz $ cd celery-0.0.0 $ python setup.py build 2.3. Celery Installation 11
  • 16. Newfies-Dialer Documentation, Release 1.1.0 $ python setup.py install # as root Using the development version You can clone the repository by doing the following: $ git clone git://github.com/ask/celery.git 12 Chapter 2. Installation
  • 17. CHAPTER THREE USER GUIDE Contents: 3.1 Overview Newfies-Dialer is an open source VoIP Dialer based on distributed message passing. It has been built to support cloud servers and also works on standalone servers. It uses Freeswitch (VoIP Server) to outbound calls, but support for other VoIP Servers such as Asterisk could be easily added in the future. The platform is focused on real-time operations and task call distributions to clustered brokers and workers. Newfies-Dialer is a computerised system that automatically dials a group of telephone numbers for connection to assigned campaigns. Features: * Restful-API based to easily integrate the platform dialer with third-party applications * Web-based administrative/customer interfaces * Lower operating costs * Calls are made through Internet VoIP. No need for telephony hardware * Call reports and Statistics 3.2 How to use Newfies-Dialer 3.2.1 Freeswitch Set-Up Configure trunks and gateways in Freeswitch by creating an XML file in /usr/local/freeswitch/conf/sip_profiles/external/ and give it an identifiable name, e.g. call-labs.xml, and place the following lines in the file, edited to suit your provider: <include> <gateway name="ip address or hostname of carrier"> <!--/// account username *required* ///--> <param name="username" value="your username provided by carrier"/> <!--/// auth realm: *optional* same as gateway name, if blank ///--> <!--<param name="realm" value="asterlink.com"/>--> <!--/// username to use in from: *optional* same as username, if blank ///--> <param name="from-user" value="your username provided by carrier"/> <!--/// domain to use in from: *optional* same as realm, if blank ///--> <!--param name="from-domain" value=""/--> <!--/// account password *required* ///--> 13
  • 18. Newfies-Dialer Documentation, Release 1.1.0 <param name="password" value="your password supplied by carrier"/> <!--/// extension for inbound calls: *optional* same as username, if blank ///--> <!--<param name="extension" value="cluecon"/>--> <!--/// proxy host: *optional* same as realm, if blank ///--> <!--<param name="proxy" value="asterlink.com"/>--> <!--/// send register to this proxy: *optional* same as proxy, if blank ///--> <!--<param name="register-proxy" value="mysbc.com"/>--> <!--/// expire in seconds: *optional* 3600, if blank ///--> <!--<param name="expire-seconds" value="60"/>--> <!--/// do not register ///--> <param name="register" value="true"/> <!-- which transport to use for register --> <!--<param name="register-transport" value="udp"/>--> <!--How many seconds before a retry when a failure or timeout occurs --> <!--<param name="retry-seconds" value="30"/>--> <!--Use the callerid of an inbound call in the from field on outbound calls via this gateway --> <!--<param name="caller-id-in-from" value="false"/>--> <!--extra sip params to send in the contact--> <!--<param name="contact-params" value="tport=tcp"/>--> <!--send an options ping every x seconds, failure will unregister and/or mark it down--> <!--<param name="ping" value="25"/>--> </gateway> </include> Then in the Freeswitch CLI (fs_cli) “sofia profile external restart reloadxml”. When the command is complete, check the gateway has registered with the command “sofia status”. 3.2.2 Create Gateway Having created the gateway in Freeswitch, Newfies-Dialer has to be told that it can use it. In admin, add a new dialer gateway, e.g. sofia/gateway/myprovider/ (The final / is important) where “myprovider” is the gateway name setting used in above xml file in Freeswitch. Only the fields in bold are compulsory. 3.2.3 Dialer Settings Dialer settings are mapped with system users who are going to create campaigns & contacts. If dialer settings are not mapped to users, notifications & emails are sent to super admin user. To create restrictions (like the Max. no of campaign, Max no of contacts etc.) for system User, Click on Add dialer settings. Add numeric values for the limit. To apply the dialer settings limit on a system user, click on Customers or Admins in admin UI, select the user to update, & apply the settings from the dialer settings list. 3.2.4 Create Voice Application A number of voice applications are provided with Newfies-Dialer. Click Add Voice App give the voice application a name, select the type of application from the dropdown, select the gateway to use if the call is to be redirected, and provide the data to be used, e.g. in the case of “Speak” this would be the words to convert to text to speech. 14 Chapter 3. User Guide
  • 19. Newfies-Dialer Documentation, Release 1.1.0 3.2.5 Create Survey The survey application for Newfies-Dialer allows polls and surveys to be taken over the phone. Each contact is called, and then played a sound file. After the sound file is heard, the user can enter their answer through the phone keypad using keys 0 to 9. Therefore before creating the survey, the first job is to upload the audio for the survey. One audio file is required for each question. Uploading Audio Files: Select Audio Files from the top menu then click add. Enter a name to describe the audio, then click chose file, select the file you require from your computer, then click submit. Note that only mp3, Wav and ogg formats are supported. The audio file will then be uploaded and renamed so that it is unique. Create the Survey: URL: • http://localhost:8000/survey/ • http://localhost:8000/survey/add/ • http://localhost:8000/survey/1/ 3.2. How to use Newfies-Dialer 15
  • 20. Newfies-Dialer Documentation, Release 1.1.0 Select Modules from the top menu, then Survey. Click the add button, then give the survey a name and description, then click Submit. A button will now appear to add a question. In the question field, put in some text to describe the question - e.g “What is 1+1”; select the audio file pertaining to the question which was uploaded in the previous step. If no audio file is selected, then the system will automatically play the text in the question field using the text to speech engine. Then click Add Response. A further two fields will appear named Key Digit and Key Value. In key Digit put a number from 0 to 9 which should be pressed for this answer. In the example “What is 1+1”, “2” should be placed in the Key Digit Field” The Key Value field is used in the survey reports, and so in this case, you would put “Correct” as 1+1=2. You may chose to add responses 0,1 and 3 to 9 as key digits, with key values of “Wrong” as these answers will then be summed up in the Survey Reports. You can then go on to add another question, and its associated responses. On completion, click Update Survey. To use the Survey in a campaign, simply create a campaign as normal, and select the Survey name in the Application drop-down. 3.2.6 Create call list To create a call list, click on Add in Phonebook list, add name of phonebook & its description. Click on Contacts and add phone numbers in the contact list. You can also import your call list from csv files, via clicking on Import contact. Update Phonebook: 16 Chapter 3. User Guide
  • 21. Newfies-Dialer Documentation, Release 1.1.0 Contact List: Import contact: 3.2. How to use Newfies-Dialer 17
  • 22. Newfies-Dialer Documentation, Release 1.1.0 3.2.7 Create campaign To create a campaign, click on Add in campaign list, add details for the campaign. Important: Add the campaign’s start and end dates with times & week-day exceptions. Select the gateway through which calls will be routed & the phonebook(s) linked with the contacts. Campaign list: 18 Chapter 3. User Guide
  • 23. Newfies-Dialer Documentation, Release 1.1.0 Update Campaign: .. image:: ../_static/images/customer/update_campaign.png Update Campaign: .. image:: ../_static/images/customer/update_campaign_part2.png 3.2.8 Dialer Settings Dialer settings has to be mapped with system users who are going to create campaigns & contacts. If dialer setting is not mapped with system users, notification & mail has been sent to Super admin user. To create restrictions (like the Max. no of campaign, Max no of contacts etc.) for system User, Click on Add in dialer settings list of admin side. Add numeric values for the limit. To apply the dialer settings limit on a system user, click on Customers or Admins in admin UI, select the user to update, & apply the settings from the dialer settings list. Dialer settings: Update dialer settings: 3.2. How to use Newfies-Dialer 19
  • 24. Newfies-Dialer Documentation, Release 1.1.0 3.2.9 Call contacts/subscribers A call-request will spool a call directly from the platform using a dialer gateway and update the call-request status after receiving a response from the gateway. 20 Chapter 3. User Guide
  • 25. Newfies-Dialer Documentation, Release 1.1.0 3.2.10 VoIP Call Report As per the status of a call-request, it will be stored in the VoIP call records. This gives information of all the calls & call statistics made with the call-request and also you can search for records on the basis of date range. You can export the VoIP call report into a csv file. 3.2. How to use Newfies-Dialer 21
  • 26. Newfies-Dialer Documentation, Release 1.1.0 22 Chapter 3. User Guide
  • 27. Newfies-Dialer Documentation, Release 1.1.0 3.2.11 Survey Report When the survey is complete, the survey results can be inspected by clicking Reporting on the top and selecting Survey Results from the drop-down. 3.2.12 Settings The settings page provides a number of functions: • Account - Change the detail of the account. • Password - Change the password. • Notifications - Display system notifications. • Limitation - Displays the parameters of the dialer settings. • Authorized - Facitiy to check that a number is not blacklisted. 3.3 Admin Panel http://localhost:8000/admin/ This interface provides user (ACL) management, full control of all Campaigns, Phonebooks, Subscribers, Gateways and configuration of the Audio Application. • Screenshot with Features 3.3. Admin Panel 23
  • 28. Newfies-Dialer Documentation, Release 1.1.0 3.3.1 Screenshot with Features Dashboard Dashboard page for the admin interface after successful login with superuser credentials Admin The Admin section allows you to create administrators who have access the admin screens. Levels of access can be set. If the administrator is to be allowed to make calls, then a gateway and dialer- settings must be set for that administrator. Customers Customers only have access to the customer panel. Before a customer can make calls, they must have both dialer- settings and a gateway attached to their account. Sites Some of the features of Newfies-Dialer are dependent on the hostname or IP address, so this has to be set correctly in site address. In the Admin dashboard, locate the “Sites” link and click change. By default, there will be an entry of “exam- ple.com”. Edit this setting to reflect the hostname of the server, or if you do not have this set up, the IP address. e.g. http://www.domain.tld:8008 or in the case of an IP address, http://192.168.1.200:8008 • http://localhost:8000/admin/sites/ 24 Chapter 3. User Guide
  • 29. Newfies-Dialer Documentation, Release 1.1.0 Phonebook The phonebook list will be displayed from the following URL. You can add a new phonebook by clicking Add phonebook and adding the name of the phonebook and its description, Also from the phonebook list, click on the phonebook that you want to update. URL: • http://localhost:8000/admin/dialer_campaign/phonebook/ To Add/Update phonebook for a user URL: • http://localhost:8000/admin/dialer_campaign/phonebook/add/ • http://localhost:8000/admin/dialer_campaign/phonebook/1/ Contact The contact list will be displayed from the following URL and you can add a new contact by clicking Add contact & adding the contact details (i.e. phone number, name, description about contact, contact status) to one phonebook from the phonebook list. If the contact is active and the linked phonebook is also attached to a running campaign, then the contact will be added into campaign subscribers. From the contact list, click on the contact that you want to update. URL: • http://localhost:8000/admin/dialer_campaign/contact/ 3.3. Admin Panel 25
  • 30. Newfies-Dialer Documentation, Release 1.1.0 To Add/Update a contact URL: • http://localhost:8000/admin/dialer_campaign/contact/add/ • http://localhost:8000/admin/dialer_campaign/contact/1/ To import bulk contacts into a phonebook, click on Import contacts. where you can upload the contacts via a CSV file in to one phonebook. URL: • http://localhost:8000/admin/dialer_campaign/contact/import_contact/ 26 Chapter 3. User Guide
  • 31. Newfies-Dialer Documentation, Release 1.1.0 Campaign The campaign list will be displayed from the following URL. You can add a new campaign by clicking Add campaign. While adding a campaign, it is important to add campaign’s start and end dates with time & week-day exceptions. Also select the gateway through which calls will be routed & the phonebook(s) linked with contacts. From the campaign list, click on the campaign that you want to update. URL: • http://localhost:8000/admin/dialer_campaign/campaign/ To Add/Update Campaign for user URL: • http://localhost:8000/admin/dialer_campaign/campaign/add/ • http://localhost:8000/admin/dialer_campaign/campaign/1/ 3.3. Admin Panel 27
  • 32. Newfies-Dialer Documentation, Release 1.1.0 Campaign Subscriber The Campaign Subscriber list will be displayed from the following URL. You can add a new campaign subscriber by clicking Add Campaign Subscriber. Also from the campaign subscriber list, click on the subscriber to update. While creating a contact, if its linked phonebook is also attached to a running campaign, then the contact will be added into the campaign subscriber. URL: • http://localhost:8000/admin/dialer_campaign/campaignsubscriber/ To Add/Update Campaign Subscriber URL: • http://localhost:8000/admin/dialer_campaign/campaignsubscriber/add/ • http://localhost:8000/admin/dialer_campaign/campaignsubscriber/1/ 28 Chapter 3. User Guide
  • 33. Newfies-Dialer Documentation, Release 1.1.0 Dialer Settings The dialer settings list will be displayed from the following URL. The Dialer settings list is applied to a system User. You can add a new setting by clicking Add Dialer Settings and add numeric values for the limit. Also from the dialer settings list, click on the setting to update. URL: • http://localhost:8000/admin/dialer_settings/dialersetting/ To Add/Update dialer settings for a Newfies-Dialer user URL: • http://localhost:8000/admin/dialer_settings/dialersetting/add/ • http://localhost:8000/admin/dialer_settings/dialersetting/1/ 3.3. Admin Panel 29
  • 34. Newfies-Dialer Documentation, Release 1.1.0 To apply dialer settings limit to a User, click on Customers or Admins, select the user to be updated & apply settings from the dialer settings list. URL: • http://localhost:8000/admin/auth/staff/1/ Dialer Gateway The Dialer Gateway list will be displayed from the following URL. You can add a new gateway by clicking Add Dialer Gateway and adding the details (e.g. gateway name, hostname, protocol etc.). Also from the gateway list, click on the gateway that you want to update. URL: • http://localhost:8000/admin/dialer_gateway/gateway/ 30 Chapter 3. User Guide
  • 35. Newfies-Dialer Documentation, Release 1.1.0 To Add/Update a dialer gateway URL: • http://localhost:8000/admin/dialer_gateway/gateway/add/ • http://localhost:8000/admin/dialer_gateway/gateway/1/ Voice Application The Voice application list will be displayed from the following URL. You can add a new application by clicking Add Voice Application. Also from the application list, click on the application to update. URL: • http://localhost:8000/admin/voice_app/voiceapp/ To Add/Update a Voice application URL: • http://localhost:8000/admin/voice_app/voiceapp/add/ 3.3. Admin Panel 31
  • 36. Newfies-Dialer Documentation, Release 1.1.0 • http://localhost:8000/admin/voice_app/voiceapp/1/ Survey The survey application for Newfies-Dialer allows polls and surveys to be taken over the phone. Each contact is called, and then played a sound file. After the sound file is heard, the user can enter their answer through the phone keypad using keys 0 to 9. Therefore before creating the survey, the first job is to upload the audio for the survey. One audio file is required for each question. Add Audio File CLick Audio Files, then click Add. Give the audio file a descriptive name, chose the file to upload. In the Admin screens, there are options to convert to other formats, change the number of channels, e.g. change from stereo to mono, and down-sample the frequency. Finally, the user can be assigned. Survey Admin Functions From the admin screen, Surveys can be added, deleted and edited. Additionally, survey questions can be re-ordered. URL: • http://localhost:8000/admin/survey/surveyapp/ To Add/Update a survey URL: • http://localhost:8000/admin/survey/surveyapp/add/ • http://localhost:8000/admin/survey/surveyapp/1/ 32 Chapter 3. User Guide
  • 37. Newfies-Dialer Documentation, Release 1.1.0 To Add/Update a survey question • http://localhost:8000/admin/survey/surveyquestion/add/ • http://localhost:8000/admin/survey/surveyquestion/1/ When the survey is complete, the results can be inspected. • http://localhost:8000/admin/survey/surveycampaignresult/ Call Request The call request list will be displayed from the following URL. You can add a new call request by clicking Add Call Request. Also from the call request list, click on the request to update. URL: • http://localhost:8000/admin/dialer_cdr/callrequest/ 3.3. Admin Panel 33
  • 38. Newfies-Dialer Documentation, Release 1.1.0 To Add/Update a Call Request URL: • http://localhost:8000/admin/dialer_cdr/callrequest/add/ • http://localhost:8000/admin/dialer_cdr/callrequest/1/ VoIP Call Report A VoIP Call list will be displayed from following URL. You can not add new call reports. URL: • http://localhost:8000/admin/dialer_cdr/voipcall/ 34 Chapter 3. User Guide
  • 39. Newfies-Dialer Documentation, Release 1.1.0 3.4 Customer Panel User Interface : http://localhost:8000/ This application provides a user interface for restricted management of the User’s Campaigns, Phonebooks and Subscribers. It also provides detailed reporting of calls and message delivery. • Screenshot with Features 3.4.1 Screenshot with Features Index Index page for the customer interface after successful login with user credentials 3.4. Customer Panel 35
  • 40. Newfies-Dialer Documentation, Release 1.1.0 Phonebook The phonebook list will be displayed from the following URL. You can add a new phonebook by clicking Add phonebook and add the name of a phonebook and its description. Also from the phonebook list, click on the phonebook to update. URL: • http://localhost:8000/dialer_campaign/phonebook/ 36 Chapter 3. User Guide
  • 41. Newfies-Dialer Documentation, Release 1.1.0 To Add/Update a Phonebook for a logged in user URL: • http://localhost:8000/dialer_campaign/phonebook/add/ • http://localhost:8000/dialer_campaign/phonebook/1/ 3.4. Customer Panel 37
  • 42. Newfies-Dialer Documentation, Release 1.1.0 Contact The contact list will be displayed from following the URL. You can add a new contact by clicking Add contact & adding the contact details (i.e. phone number, name, description about contact, contact status) under the logged in user’s phonebook from the phonebook list. On the contact list, click on the contact to update. URL: • http://localhost:8000/dialer_campaign/contact/ To Add/Update a contact in a phonebook URL: • http://localhost:8000/dialer_campaign/contact/add/ • http://localhost:8000/dialer_campaign/contact/1/ 38 Chapter 3. User Guide
  • 43. Newfies-Dialer Documentation, Release 1.1.0 To import bulk contacts into a phonebook, click on Import. where you can upload contacts via a CSV file under a logged in user’s phonebook. URL: • http://localhost:8000/dialer_campaign/contact/import/ 3.4. Customer Panel 39
  • 44. Newfies-Dialer Documentation, Release 1.1.0 Voice Application A number of voice applications are provided with Newfies-Dialer. Click Add Voice App give the voice application a name, select the type of application from the dropdown, select the gateway to use if the call is to be redirected, and provide the data to be used, e.g. in the case of “Speak” this would be the words to convert to text to speech. URL: • http://localhost:8000/voiceapp/ 40 Chapter 3. User Guide
  • 45. Newfies-Dialer Documentation, Release 1.1.0 To Add/Update a contact in a voice app URL: • http://localhost:8000/voiceapp/add/ • http://localhost:8000/voiceapp/1/ A Number of voice applications currently supported are:- 3.4. Customer Panel 41
  • 46. Newfies-Dialer Documentation, Release 1.1.0 Dial: The dial command allows the call to be redirected another destination. In this case, Select the B-Leg as the trunk to be used for the redirected call. Conference: Direct the contact into a conference which has previously been defined in Freeswitch. In the Data field, put the name or extension number. PlayAudio: PlayAudio plays a sound file that has previously been uploaded to the system. The Audio is uploaded via the Audio Files menu on the top menu. Click add, then select the file on your computer to be uploaded. The file will be renamed with a unique name. It can be played via the web browser. In the data field in the voice application, either put the full file path to the sound file. Typically this is /usr/share/newfies/usermedia/upload/audiofiles/audio-file-XXXX-12345678.mp3 However where there are multiple Freeswitch nodes and workers, the sound file can uploaded to Newfies-Dialer, and the Web URL placed in the Data field. Typically, this will be • http://domain.tld:8008/mediafiles/upload/audiofiles/-XXXX-12345678.mp3 This allows other Freeswitch nodes to download and play the audio file on demand without having to upload it to each node. Speak: This will call a contact, and then using the text to speech engine, which is Flite as standard, play the audio in the Data field. Survey: A survey and polling application which is described in more detail in a subsequent section. Survey The survey application for Newfies-Dialer allows polls and surveys to be taken over the phone. Each contact is called, and then played a sound file. After the sound file is heard, the user can enter their answer through the phone keypad using keys 0 to 9. Therefore before creating the survey, the first job is to upload the audio for the survey. One audio file is required for each question. Uploading Audio Files: Select Audio Files from the top menu then click add. Enter a name to describe the audio, then click chose file, select the file you require from your computer, then click submit. Note that only mp3, Wav and ogg formats are supported. The audio file will then be uploaded and renamed so that it is unique. Create the Survey: URL: • http://localhost:8000/survey/ • http://localhost:8000/survey/add/ • http://localhost:8000/survey/1/ 42 Chapter 3. User Guide
  • 47. Newfies-Dialer Documentation, Release 1.1.0 Select Modules from the top menu, then Survey. Click the add button, then give the survey a name and description, then click Submit. A button will now appear to add a question. In the question field, put in some text to describe the question - e.g “What is 1+1”; select the audio file pertaining to the question which was uploaded in the previous step. If no audio file is selected, then the system will automatically play the text in the question field using the text to speech engine. Then click Add Response. A further two fields will appear named Key Digit and Key Value. In key Digit put a number from 0 to 9 which should be pressed for this answer. In the example “What is 1+1”, “2” should be placed in the Key Digit Field” The Key Value field is used in the survey reports, and so in this case, you would put “Correct” as 1+1=2. You may chose to add responses 0,1 and 3 to 9 as key digits, with key values of “Wrong” as these answers will then be summed up in the Survey Reports. You can then go on to add another question, and its associated responses. On completion, click Update Survey. To use the Survey in a campaign, simply create a campaign as normal, and select the Survey name in the Application drop-down. Survey Results When the survey is complete, the survey results can be inspected by clicking Reporting on the top and selecting Survey Results from the drop-down. Campaign The campaign list will be displayed from the following URL. You can add a new campaign for the logged in user by clicking Add campaign. When adding a campaign, it is important to add the campaign’s start and end dates with 3.4. Customer Panel 43
  • 48. Newfies-Dialer Documentation, Release 1.1.0 time & week-day exceptions. Select the gateway through which calls will be routed & phonebook(s) that are linked with contacts from the campaign list, click on campaign to update. URL: • http://localhost:8000/dialer_campaign/campaign/ To Add/Update a Campaign for a logged in user URL: • http://localhost:8000/dialer_campaign/campaign/add/ • http://localhost:8000/dialer_campaign/campaign/1/ 44 Chapter 3. User Guide
  • 49. Newfies-Dialer Documentation, Release 1.1.0 3.4. Customer Panel 45
  • 50. Newfies-Dialer Documentation, Release 1.1.0 Dashboard Dashboard gives the information anbout campaign & its related call records 46 Chapter 3. User Guide
  • 51. Newfies-Dialer Documentation, Release 1.1.0 3.4. Customer Panel 47
  • 52. Newfies-Dialer Documentation, Release 1.1.0 48 Chapter 3. User Guide
  • 53. CHAPTER FOUR CONFIGURATION AND DEFAULTS Contents: 4.1 Sample Configuration This is a sample configuration to get you started. It should contain all you need to create a basic set-up. 4.1.1 The Configuration Module Some of the more important parts of the configuration module for the Newfies, settings.py, are explained below: import os.path APPLICATION_DIR = os.path.dirname(globals()[’__file__’]) APPLICATION_DIR now contains the full path of your project folder and can be used elsewhere in the settings.py module so that your project may be moved around the system without you having to worry about changing any troublesome hard-coded paths. DEBUG = True turns on debug mode allowing the browser user to see project settings and temporary variables. ADMINS = ( (’xyz’, ’[email protected]’) ) sends all errors from the production server to the admin’s email address. DATABASE_ENGINE = ’mysql’ DATABASE_NAME = ’db-name’ DATABASE_USER = ’user’ DATABASE_PASSWORD = ’password’ DATABASE_HOST = ’mysql-host’ DATABASE_PORT = ’’ sets up the options required for Django to connect to your database. MEDIA_ROOT = os.path.join(APPLICATION_DIR, ’static’) tells Django where to find your media files such as images that the HTML templates might use. ROOT_URLCONF = ’urls’ tells Django to start finding URL matches at in the urls.py module in the newfies project folder. 49
  • 54. Newfies-Dialer Documentation, Release 1.1.0 TEMPLATE_DIRS = ( os.path.join(APPLICATION_DIR, ’templates’), ) tells Django where to find your HTML template files. INSTALLED_APPS = ( ’django.contrib.auth’, ’django.contrib.contenttypes’, ’django.contrib.sessions’, ’django.contrib.sites’, ’django.contrib.admin’, ... ’dialer_gateway’, ’dialer_campaign’, ’dialer_cdr’, ’dialer_settings’, ’user_profile’, ’voip_server’, ’voip_app’, ... ) tells Django which applications (custom and external) to use in your project. The custom applications, dialer_gateway, dialer_campaign etc. are stored in the project folder along with these custom applica- tions. 4.1.2 The URLs modules The defined URL patterns for the CPI Pilot project are divided into URL patterns specific to the project and URL patterns specific to the applications. For more information on how the pattern matching syntax work or how to write your own url patterns please consult Django’s URL Dispatcher documentation. Project specific URL patterns The URL patterns specific to the project are applied in the urls.py file that is stored in the project directory newfies. The code segments that add these URL patterns aren’t lengthy and are shown below: urlpatterns = patterns(’’, # redirect (’^$’, ’django.views.generic.simple.redirect_to’, {’url’: ’/dialer_campaign/’}), (r’^admin/’, include(admin.site.urls)), (r’^api/dialer_campaign/’, include(’dialer_campaign.api.urls’)), (r’^dialer_campaign/’, include(’dialer_campaign.urls’)), (r’^static/(?P<path>.*)$’, ’django.views.static.serve’, {’document_root’: settings.STATIC_ROOT}), ) Application specific URL patterns The URL patterns specific to the dialer_campaign application are applied in the /dialer_campaign/urls.py file in the dialer_campaign application folder. The code segment that adds these URL patterns isn’t lengthy either and is shown below: urlpatterns = patterns(’dialer_campaign.views’, (r’^phonebook/$’, ’phonebook_list’), (r’^phonebook/add/$’, ’phonebook_add’), 50 Chapter 4. Configuration and Defaults
  • 55. Newfies-Dialer Documentation, Release 1.1.0 (r’^phonebook/(.+)/$’, ’phonebook_change’), ) 4.1.3 The Views module The functions defined in views.py represent the logic behind the webpages. The view functions (called through the URL matching) decide which data structures need to be constructed and sent through to the HTML templates. To do this, each view function uses Django’s object relational model (ORM) to query the database picking out what is needed for any particular page. @login_required def phonebook_add(request): """ Add new Phonebook """ form = PhonebookForm() if request.method == ’POST’: form = PhonebookForm(request.POST) if form.is_valid(): obj = form.save(commit=False) obj.user = User.objects.get(username=request.user) obj.save() request.session["msg"] = _(’"%s" is added.’ % request.POST[’name’]) return HttpResponseRedirect(’/dialer_campaign/phonebook/’) template = ’dialer_campaign/phonebook/change.html’ data = { ’form’: form, ’action’: ’add’, } return render_to_response(template, data, context_instance=RequestContext(request)) 4.1.4 The Admin Module The classes defined in admin.py tell Django what attributes are visible and modifiable from the admin site. Code for naming convention (e.g. Voip -> VoIP) (in admin.py) Example: def get_urls(self): urls = super(VoipAppAdmin, self).get_urls() my_urls = patterns(’’, (r’^add/$’, self.admin_site.admin_view(self.add_view)), ) return my_urls + urls def add_view(self, request, extra_context=None): ctx = { ’app_label’: _(’VoIP’), ’title’: _(’Add VoIP’), } return super(VoipAppAdmin, self) .add_view(request, extra_context=ctx) 4.1. Sample Configuration 51
  • 56. Newfies-Dialer Documentation, Release 1.1.0 4.2 Celery Configuration 4.2.1 After installing Broker (Redis or Rabbitmq) 1. Redis Settings This is a configuration example for Redis. # Redis Settings CARROT_BACKEND = "ghettoq.taproot.Redis" BROKER_HOST = "localhost" # Maps to redis host. BROKER_PORT = 6379 # Maps to redis port. BROKER_VHOST = "0" # Maps to database number. CELERY_RESULT_BACKEND = "redis" REDIS_HOST = "localhost" REDIS_PORT = 6379 REDIS_DB = 0 #REDIS_CONNECT_RETRY = True 2. Rabbitmq Settings This is a configuration example for Rabbitmq. BROKER_HOST = "localhost" BROKER_PORT = 5672 BROKER_USER = "root" BROKER_PASSWORD = "root" BROKER_VHOST = "localhost" CELERY_RESULT_BACKEND = "amqp" 4.2.2 Launch celery/celerybeat in debug mode If you don’t want to run celeryd and celerybeat as a daemon then To run celeryd $ python manage.py celeryd -E -l debug To run celerybeat $ python manage.py celerybeat --schedule=/var/run/celerybeat-schedule To run both $ python manage.py celeryd -E -B -l debug 4.2.3 Running celeryd/celerybeat as a daemon (Debian/Ubuntu) To configure celeryd you will need to tell it where to change directory to, when it starts in order to find your celerycon- fig. 52 Chapter 4. Configuration and Defaults
  • 57. Newfies-Dialer Documentation, Release 1.1.0 $ cd install/celery-init/etc/default/ 1. Open celeryd in text editor & change the following variables Configuration file: /etc/default/celeryd Init script: celeryd. Usage : /etc/init.d/celeryd {start|stop|force-reload|restart|try-restart|status}: # Where to chdir at start CELERYD_CHDIR="/path/to/newfies/" # Path to celeryd CELERYD="/path/to/newfies/manage.py celeryd" # Extra arguments to celeryd CELERYD_OPTS="--time-limit=300" # Name of the celery config module. CELERY_CONFIG_MODULE="celeryconfig" # Extra Available options # %n will be replaced with the nodename. # Full path to the PID file. Default is /var/run/celeryd.pid. CELERYD_PID_FILE="/var/run/celery/%n.pid" # Full path to the celeryd log file. Default is /var/log/celeryd.log CELERYD_LOG_FILE="/var/log/celery/%n.log" # User/Group to run celeryd as. Default is current user. # Workers should run as an unprivileged user. CELERYD_USER="celery" CELERYD_GROUP="celery" 2. Open celeryd (for periodic task) in text editor & add the following variables Configuration file: /etc/default/celerybeat or /etc/default/celeryd Init script: celerybeat Usage: /etc/init.d/celerybeat {start|stop|force-reload|restart|try-restart|status}: # Path to celerybeat CELERYBEAT="/path/to/newfies/manage.py celerybeat" # Extra arguments to celerybeat CELERYBEAT_OPTS="--schedule=/var/run/celerybeat-schedule" 3. Copy the configuration file & init scripts to /etc dir: $ cp etc/default/celeryd /etc/default/ $ cp etc/init.d/celeryd /etc/init.d/ $ cp etc/init.d/celerybeat /etc/init.d/ 4. Run/Start or Stop celery as a daemon: $ /etc/init.d/celeryd start or stop $ /etc/init.d/celerybeat start or stop 4.2. Celery Configuration 53
  • 58. Newfies-Dialer Documentation, Release 1.1.0 4.2.4 Troubleshooting If you can’t get the celeryd as a daemon to work, you should try running them in verbose mode: $ sh -x /etc/init.d/celeryd start $ sh -x /etc/init.d/celerybeat start 54 Chapter 4. Configuration and Defaults
  • 59. CHAPTER FIVE FREESWITCH INSTALLATION AND CONFIGURATION Contents: 5.1 Freeswitch Installation and configuration Freeswitch is the telephony engine used by Newfies-Dialer to make calls, as well as broadcast voice applications Newfies-Dialer communicates with Freeswitch though the Event-Socket. Communication is made via the Communi- cations Framework Plivo. Our Freeswitch dependencies are the same as Plivo, therefore the following modules will need to be installed mod_curl, asr_tts, mod_flite, asr_tts, mod_shout, mod_dingaling, mod_shell_stream, mod_xml_cdr In order to retrieve CDR Status from the outbound calls, you will have to configure xml_cdr.conf.xml and point it to the Newfies API to store CDR, which is by default : http://hostname_newfies/api/dialer_cdr/store_cdr/ A script for Freeswitch Installation which will install Freeswitch with the required modules and configure it for you is available. Download and run the Freeswitch installation script. Once logged in as root, execute the following command: wget https://raw.github.com/Star2Billing/newfies-dialer/master/install/install-freeswitch.sh The above commmand download the installation script. We can then execute the script with the following command: bash install-freeswitch.sh This will download and install Freeswitch with the modules appropriate for Newfies-Dialer. The installation will take some time, but does not require your interaction once started. 5.2 Plivo Installation and configuration When Freeswitch is installed, the next task is to install Plivo. Plivo is an open source communications framework to rapidly deploy voice based applications used in conjunction with Newfies-Dialer. Run the following commands: 55
  • 60. Newfies-Dialer Documentation, Release 1.1.0 wget https://raw.github.com/plivo/plivo/master/scripts/plivo_install_beta.sh then: bash plivo_install_beta.sh /usr/share/plivo This will download and install Plivo and all its dependencies. We need to have Plivo start on boot, so run the following command to make it automatically start. ln -s /usr/share/plivo/bin/plivo /etc/rc2.d/S99plivo Please note that the Plivo script makes alterations to the Freeswitch dial-plan, so it should not be blindly run on an existing working Freeswitch installation, as it will change your current configuration. If you wish to install Plivo on an existing version of Freeswitch, use the script as a guide, or edit it to suit your requirements. 5.3 Freeswitch Trunk configuration In order for Newfies-Dialer to make outbound calls to its subscribers, you will need a SIP trunk. The Freeswitch wiki can provide more information on configuring trunks. However creating a trunk simply for Newfies-Dialer is straightforward. Trunks or gateways, as they are known in Freeswitch, are configured using XML syntax, so using your favourite text editor, while logged in as root “sudo su -” create an XML file in /usr/local/freeswitch/conf/sip_profiles/external/ and give it an identifiable name, e.g. call-labs.xml, and place the following lines in the file: <include> <gateway name="ip address or hostname of carrier"> <!--/// account username *required* ///--> <param name="username" value="your username provided by carrier"/> <!--/// auth realm: *optional* same as gateway name, if blank ///--> <!--<param name="realm" value="asterlink.com"/>--> <!--/// username to use in from: *optional* same as username, if blank ///--> <param name="from-user" value="your username provided by carrier"/> <!--/// domain to use in from: *optional* same as realm, if blank ///--> <!--param name="from-domain" value=""/--> <!--/// account password *required* ///--> <param name="password" value="your password supplied by carrier"/> <!--/// extension for inbound calls: *optional* same as username, if blank ///--> <!--<param name="extension" value="cluecon"/>--> <!--/// proxy host: *optional* same as realm, if blank ///--> <!--<param name="proxy" value="asterlink.com"/>--> <!--/// send register to this proxy: *optional* same as proxy, if blank ///--> <!--<param name="register-proxy" value="mysbc.com"/>--> <!--/// expire in seconds: *optional* 3600, if blank ///--> <!--<param name="expire-seconds" value="60"/>--> <!--/// do not register ///--> <param name="register" value="true"/> <!-- which transport to use for register --> <!--<param name="register-transport" value="udp"/>--> <!--How many seconds before a retry when a failure or timeout occurs --> <!--<param name="retry-seconds" value="30"/>--> <!--Use the callerid of an inbound call in the from field on outbound calls via this gateway --> <!--<param name="caller-id-in-from" value="false"/>--> <!--extra sip params to send in the contact--> <!--<param name="contact-params" value="tport=tcp"/>--> <!--send an options ping every x seconds, failure will unregister and/or mark it down--> <!--<param name="ping" value="25"/>--> 56 Chapter 5. FreeSwitch Installation and Configuration
  • 61. Newfies-Dialer Documentation, Release 1.1.0 </gateway> </include> The uncommented lines are almost certainly required by your carrier and Freeswitch, the remaining parameters can be uncommented and used, if required by your carrier. The XML syntax for comments are denoted by lines that begin “ <!– “ and end in “–> “. Finally we need to load the new configuration, and check the trunk is registered. Enter the Freeswitch CLI (Command Line Interface) from the console: /usr/local/freeswitch/bin/fs_cli You should now see the Freeswitch CLI, so now reload the Freeswitch configuration with the following command: (tip; Tab auto-completes): sofia profile external restart reloadxml When complete, check the trunk has registered with the command: sofia status Against the name of the trunk you configured in the XML file, you should see REGED (registered) at the end of the line. Take a note of the trunk name, we are going to need it for telling Newfies-Dialer that it can use this trunk. To exit the Freeswitch CLI, do CTRL D, or /exit Freeswitch configuration is now complete. 5.3. Freeswitch Trunk configuration 57
  • 62. Newfies-Dialer Documentation, Release 1.1.0 58 Chapter 5. FreeSwitch Installation and Configuration
  • 63. CHAPTER SIX DEVELOPER DOC Contents: 6.1 Prerequisites To fully understand this project, developers will need to have a advanced knowledge of: • Django : http://www.djangoproject.com/ • Celery : http://celeryproject.org/ • Python : http://www.python.org/ • Freeswitch : http://freeswitch.org/ • Freeswitch : Event_Sockets (wiki.freeswitch.org/wiki/Mod_event_socket) 6.2 Coding Style & Structure 6.2.1 Style Coding follows the PEP 8 Style Guide for Python Code. 6.2.2 Structure The newfies directory: |-- custom_admin_tools - The code for admin dashboard/menu |-- dialer_campaign - The code for dialer campaign | |-- api | ‘-- fixtures |-- dialer_cdr - This defines the call request & its information | |-- api | ‘-- fixtures |-- dialer_gateway - This defines the trunk to deliver the VoIP Calls | ‘-- fixtures |-- dialer_settings - This defines sets of settings to apply on user |-- voip_app - This defines application that are defined on the platform | ‘-- fixtures |-- static 59
  • 64. Newfies-Dialer Documentation, Release 1.1.0 | |-- newfies | | |-- css | | |-- js | | ‘-- images |-- user_profile - The code for user profile to extend auth model of Django |-- resources - This area is used to hold media files ‘-- templates - This area is used to override templates |-- admin | |-- dialer_campaign | ‘-- dialer_cdr |-- admin_tools |-- registration |-- memcache_status ‘-- frontend 6.3 Objects Description 6.3.1 Phonebook class dialer_campaign.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 6.3.2 Contact class dialer_campaign.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 60 Chapter 6. Developer doc
  • 65. Newfies-Dialer Documentation, Release 1.1.0 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 6.3.3 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 6.3.4 Campaign class dialer_campaign.models.Campaign(*args, **kwargs) This defines the Campaign Attributes: •campaign_code - Autogenerate 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 retry allowed per user •maxretry - Max retry allowed per user •intervalretry - Time to wait between retries in seconds •calltimeout - Number of seconds to timeout on calls •aleg_gateway - Gateway to use to reach the contact •extra_data - Additional data to pass to the application 6.3. Objects Description 61
  • 66. Newfies-Dialer Documentation, Release 1.1.0 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: dialer_campaign campaignsubscriber_detail() This will link to campaign subscribers who are associated with the campaign count_contact_of_phonebook(status=None) Count the no. of Contacts in a phonebook get_active_callmaxduration() Get the active call max duration 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 campaign is_authorized_contact(str_contact) Check if a contact is authorized progress_bar() Progress bar generated based on no of contacts update_campaign_status() Update the campaign’s status For example, If campaign is active, you can change status to ‘Pause’ or ‘Stop’ 6.3.5 CampaignSubscriber class dialer_campaign.models.CampaignSubscriber(*args, **kwargs) This defines the Contact imported to a Campaign Attributes: •last_attempt - •count_attempt - •duplicate_contact - •status - Relationships: •contact - Foreign key relationship to the Contact model. 62 Chapter 6. Developer doc
  • 67. Newfies-Dialer Documentation, Release 1.1.0 •campaign - Foreign key relationship to the Campaign model. Name of DB table: dialer_campaign_subscriber 6.3.6 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 •campaign_subscriber - Foreign key relationship to the CampaignSubscriber Model. •campaign - Foreign key relationship to the Campaign model. Name of DB table: dialer_callrequest 6.3.7 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: 6.3. Objects Description 63
  • 68. Newfies-Dialer Documentation, Release 1.1.0 •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 6.3.8 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 gate- way separated by comma •gateway_timeouts - “10,10”, # Seconds to timeout in string for each gateway separated by comma 64 Chapter 6. Developer doc
  • 69. Newfies-Dialer Documentation, Release 1.1.0 •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 6.3.9 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_number_campaign - Max Number of campaigns •max_number_subscriber_campaign - Max Number of subscribera •blacklist - Used to blacklist phone numbers to be called •whitelist - Used to whitelist phone numbers to be called Name of DB table: dialer_setting 6.3.10 UserProfile class user_profile.models.UserProfile(*args, **kwargs) This defines extra features for the user Attributes: •accountcode - Account name. Relationships: •user - Foreign key relationship to the User model. •userprofile_gateway - ManyToMany •userprofile_voipservergroup - ManyToMany •dialersetting - Foreign key relationship to the DialerSetting model. 6.3. Objects Description 65
  • 70. Newfies-Dialer Documentation, Release 1.1.0 Name of DB table: user_profile 6.4 Database Design The current database schema is shown below: 6.5 Newfies-Dialer Views 6.5.1 index dialer_campaign.views.index(request) Index view of the Customer Interface Attributes: •form - LoginForm •template - frontend/index.html 6.5.2 customer_dashboard dialer_campaign.views.customer_dashboard(request, *args, **kwargs) Customer dashboard gives the following information •No of Campaigns for logged in user •Total phonebook contacts •Total Campaigns contacts •Amount of contact reached today •Disposition of calls via pie chart •Call records & Duration of calls are shown on graph by days/hours basis. Attributes: •template - frontend/dashboard.html 66 Chapter 6. Developer doc
  • 71. Newfies-Dialer Documentation, Release 1.1.0 •form - DashboardForm 6.5.3 login_view dialer_campaign.views.login_view(request) Check User credentials Attributes: •form - LoginForm •template - frontend/index.html Logic Description: •Submitted user credentials need to be checked. If it is not valid then the system will redirect to the login page. •If submitted user credentials are valid then system will redirect to the dashboard. 6.5.4 cust_password_reset dialer_campaign.views.cust_password_reset(request) Use django.contrib.auth.views.password_reset view method for forgotten pass- word on the Customer UI This method sends an e-mail to the user’s email-id which is entered in password_reset_form 6.5.5 cust_password_reset_done dialer_campaign.views.cust_password_reset_done(request) Use django.contrib.auth.views.password_reset_done view method for forgotten password on the Customer UI This will show a message to the user who is seeking to reset their password. 6.5.6 cust_password_reset_confirm dialer_campaign.views.cust_password_reset_confirm(request, uidb36=None, token=None) Use django.contrib.auth.views.password_reset_confirm view method for for- gotten password on the Customer UI This will allow a user to reset their password. 6.5.7 common_send_notification dialer_campaign.views.common_send_notification(request, status, recipi- ent=None) User Notification (e.g. start | stop | pause | abort | contact/camapign limit) needs to be saved. It is a common function for the admin and customer UI’s Attributes: •pk - primary key of the campaign record 6.5. Newfies-Dialer Views 67
  • 72. Newfies-Dialer Documentation, Release 1.1.0 •status - get label for notifications Logic Description: •This function is used by update_campaign_status_admin() & update_campaign_status_cust() 6.5.8 common_campaign_status dialer_campaign.views.common_campaign_status(pk, status) 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: •pk - primary key of the campaign record •status - selected status for the campaign record Logic Description: •Selected Campaign’s status needs to be changed. Changed status can be start, stop or pause. •This function is used by update_campaign_status_admin() & update_campaign_status_cust() 6.5.9 phonebook_list dialer_campaign.views.phonebook_list(request, *args, **kwargs) Phonebook list for the logged in user Attributes: •template - frontend/phonebook/list.html Logic Description: •List all phonebooks which belong to the logged in user. 6.5.10 phonebook_grid dialer_campaign.views.phonebook_grid(request, *args, **kwargs) Phonebook list in json format for flexigrid. Model: Phonebook Fields: [id, name, description, updated_date] 6.5.11 phonebook_add dialer_campaign.views.phonebook_add(request, *args, **kwargs) Add new Phonebook for the logged in user Attributes: •form - PhonebookForm •template - frontend/phonebook/change.html Logic Description: 68 Chapter 6. Developer doc
  • 73. Newfies-Dialer Documentation, Release 1.1.0 •Add a new phonebook which will belong to the logged in user via the phonebookForm & get redirected to the phonebook list 6.5.12 phonebook_change dialer_campaign.views.phonebook_change(request, *args, **kwargs) Update/Delete Phonebook for the logged in user Attributes: •object_id - Selected phonebook object •form - PhonebookForm •template - frontend/phonebook/change.html Logic Description: •Update/delete selected phonebook from the phonebook list via PhonebookForm & get redi- rected to phonebook list 6.5.13 contact_list dialer_campaign.views.contact_list(request, *args, **kwargs) Contact list for the logged in user Attributes: •template - frontend/contact/list.html •form - ContactSearchForm Logic Description: •List all contacts from phonebooks belonging to the logged in user 6.5.14 contact_grid dialer_campaign.views.contact_grid(request, *args, **kwargs) Contact list in json format for flexigrid Model: Contact Fields: [id, phonebook__name, contact, last_name, first_name, description, status, addi- tional_vars, updated_date] 6.5.15 contact_add dialer_campaign.views.contact_add(request, *args, **kwargs) Add a new contact into the selected phonebook for the logged in user Attributes: •form - ContactForm •template - frontend/contact/change.html Logic Description: •Before adding a contact, check dialer setting limit if applicable to the user. •Add new contact belonging to the logged in user via ContactForm & get redirected to the contact list 6.5. Newfies-Dialer Views 69
  • 74. Newfies-Dialer Documentation, Release 1.1.0 6.5.16 contact_change dialer_campaign.views.contact_change(request, *args, **kwargs) Update/Delete contact for the logged in user Attributes: •object_id - Selected contact object •form - ContactForm •template - frontend/contact/change.html Logic Description: •Update/delete selected contact from the contact list via ContactForm & get redirected to the contact list 6.5.17 contact_import dialer_campaign.views.contact_import(request, *args, **kwargs) Import CSV file of Contacts for the logged in user Attributes: •form - Contact_fileImport •template - frontend/contact/import_contact.html Logic Description: •Before adding contacts, check dialer setting limit if applicable to the user. •Add new contacts which will belong to the logged in user via csv file & get the result (upload success and failure statistics) Important variable: •total_rows - Total no. of records in the CSV file •retail_record_count - No. of records imported from the CSV file 6.5.18 campaign_list dialer_campaign.views.campaign_list(request, *args, **kwargs) List all campaigns for the logged in user Attributes: •template - frontend/campaign/list.html Logic Description: •List all campaigns belonging to the logged in user 6.5.19 campaign_grid dialer_campaign.views.campaign_grid(request, *args, **kwargs) Campaign list in json format for flexigrid Model: Campaign 70 Chapter 6. Developer doc
  • 75. Newfies-Dialer Documentation, Release 1.1.0 6.5.20 campaign_add dialer_campaign.views.campaign_add(request, *args, **kwargs) Add a new campaign for the logged in user Attributes: •form - CampaignForm •template - frontend/campaign/change.html Logic Description: •Before adding a campaign, check dialer setting limit if applicable to the user. •Add the new campaign which will belong to the logged in user via CampaignForm & get redi- rected to campaign list 6.5.21 campaign_change dialer_campaign.views.campaign_change(request, *args, **kwargs) Update/Delete campaign for the logged in user Attributes: •object_id - Selected campaign object •form - CampaignForm •template - frontend/campaign/change.html Logic Description: •Update/delete selected campaign from the campaign list via CampaignForm & get redirected to the campaign list 6.6 Newfies-Dialer Admin Views 6.6.1 CampaignAdmin class dialer_campaign.admin.CampaignAdmin(model, admin_site) Allows the administrator to view and modify certain attributes of a Campaign. add_view(request, extra_context=None) Override django add_view method for checking the dialer setting limit Logic Description: •Before adding campaign, checked dialer setting limit if applicable to the user, if matched, the user will be redirected to the campaign list 6.6.2 PhonebookAdmin class dialer_campaign.admin.PhonebookAdmin(model, admin_site) Allows the administrator to view and modify certain attributes of a Phonebook. 6.6. Newfies-Dialer Admin Views 71
  • 76. Newfies-Dialer Documentation, Release 1.1.0 6.6.3 ContactAdmin class dialer_campaign.admin.ContactAdmin(model, admin_site) Allows the administrator to view and modify certain attributes of a Contact. add_view(request, extra_context=None) Override django admin add_view method for checking the dialer setting limit Logic Description: •Before adding a contact, check the dialer setting limit if applicable to the user. If matched, the user will be redirected to the contact list import_contact(request) Add custom method in django admin view to import CSV file of Contacts Attributes: •form - Contact_fileImport •template - admin/dialer_campaign/contact/import_contact.html Logic Description: •Before adding contact, check the dialer setting limit if applicable to the user. •Add a new contact which will belong to the logged in user via csv file & get the result (Upload success & failure statistics) Important variable: •total_rows - Total no. of records in the CSV file •retail_record_count - No. of records which are imported from The CSV file 6.6.4 CampaignSubscriberAdmin class dialer_campaign.admin.CampaignSubscriberAdmin(model, admin_site) Allows the administrator to view and modify certain attributes of a CampaignSubscriber. 6.6.5 CallrequestAdmin class dialer_cdr.admin.CallrequestAdmin(model, admin_site) Allows the administrator to view and modify certain attributes of a Callrequest. 6.6.6 VoIPCallAdmin class dialer_cdr.admin.VoIPCallAdmin(model, admin_site) Allows the administrator to view and modify certain attributes of a VoIPCall. changelist_view(request, extra_context=None) Override changelist_view method of django-admin for search parameters Attributes: •form - VoipSearchForm •template - admin/dialer_cdr/voipcall/change_list.html Logic Description: 72 Chapter 6. Developer doc
  • 77. Newfies-Dialer Documentation, Release 1.1.0 •VoIP report Record Listing with search option & Daily Call Report search Parameters: by date, by status and by billed. export_voip_report(request) Export a CSV file of VoIP call records Important variable: •request.session[’voipcall_record_qs’] - stores voipcall query set Exported fields: [user, callid, callerid, phone_number, starting_date, duration, disposition, used_gateway] has_add_permission(request) Remove add permission on VoIP Call Report model Logic Description: •Override django admin has_add_permission method to remove add permission on VoIP Call Report model used_gateway_link(obj) Used gateway link to edit gateway detail user_link(obj) User link to user profile 6.6.7 GatewayAdmin class dialer_gateway.admin.GatewayAdmin(model, admin_site) Allows the administrator to view and modify certain attributes of a Gateway. 6.6.8 DialerSettingAdmin class dialer_settings.admin.DialerSettingAdmin(model, admin_site) Allows the administrator to view and modify certain attributes of a DialerSetting. add_view(request, extra_context=None) Add Dialer setting change_view(request, object_id, extra_context=None) Edit dialer settings changelist_view(request, extra_context=None) Dialer setting list 6.7 Newfies Tasks class dialer_campaign.tasks.check_campaign_pendingcall This will execute the outbound calls in the campaign Attributes: •campaign_id - Campaign ID 6.7. Newfies Tasks 73
  • 78. Newfies-Dialer Documentation, Release 1.1.0 class dialer_campaign.tasks.campaign_running A periodic task that checks the campaign, create and tasks the calls Usage: campaign_running.delay() class dialer_campaign.tasks.collect_subscriber This task will collect all the subscribers Attributes: •campaign_id - Campaign ID class dialer_cdr.tasks.init_callrequest This task outbounds the call Attributes: •callrequest_id - Callrequest ID class dialer_cdr.tasks.callrequest_pending A periodic task that checks for pending calls Usage: callrequest_pending.delay() 6.8 Newfies Signals 6.8.1 post_save_add_contact dialer_campaign.models.post_save_add_contact(sender, **kwargs) A post_save signal is sent by the Contact model instance whenever it is going to save. Logic Description: •When new contact is added into Contact model, active the campaign list will be checked with the contact status. •If the active campaign list count is more than one & the contact is active, the contact will be added into CampaignSubscriber model. 6.9 Test Case Descriptions 6.9.1 Requirement Run/Start Celery: $ /etc/init.d/celery start or: $ python manage.py celeryd -l info Run/Start Redis: 74 Chapter 6. Developer doc
  • 79. Newfies-Dialer Documentation, Release 1.1.0 $ /etc/init.d/redis-server start 6.9.2 How to run test 1. Run Full Test Suit: $ python manage.py test --verbosity=2 2. Run NewfiesTastypieApiTestCase: $ python manage.py test dialer_cdr.NewfiesTastypieApiTestCase --verbosity=2 3. Run NewfiesAdminInterfaceTestCase: $ python manage.py test dialer_cdr.NewfiesAdminInterfaceTestCase --verbosity=2 4. Run NewfiesCustomerInterfaceTestCase: $ python manage.py test dialer_cdr.NewfiesCustomerInterfaceTestCase --verbosity=2 6.9.3 Tastypie API Test Case class dialer_cdr.tests.NewfiesTastypieApiTestCase(methodName=’runTest’) Test cases for Newfies-Dialer API. test_create_answercall() Test Function to create a answercall test_create_bulk_contact() Test Function to bulk create contacts test_create_callrequest() Test Function to create a callrequest test_create_campaign() Test Function to create a campaign test_create_campaign_subscriber() Test Function to create a campaign subscriber test_create_cdr() Test Function to create a CDR test_create_hangupcall() Test Function to create a hangupcall test_create_phonebook() Test Function to create a phonebook test_create_survey() Test Function to create a survey test_create_survey_question() Test Function to create a survey question test_create_survey_response() Test Function to create a survey response 6.9. Test Case Descriptions 75
  • 80. Newfies-Dialer Documentation, Release 1.1.0 test_delete_campaign() Test Function to delete a campaign test_delete_cascade_campaign() Test Function to cascade delete a campaign test_read_callrequest() Test Function to get all callrequests test_read_campaign() Test Function to get all campaigns test_read_campaign_subscriber() Test Function to get all campaign subscriber test_read_phonebook() Test Function to get all phonebooks test_read_survey() Test Function to get all surveys test_read_survey_question() Test Function to get all survey questions test_read_survey_response() Test Function to get all survey response test_update_campaign() Test Function to update a campaign test_update_campaign_subscriber() Test Function to update a campaign subscriber test_update_survey() Test Function to update a survey test_update_survey_question() Test Function to update a survey question test_update_survey_response() Test Function to update a survey response 6.9.4 Admin Interface Test Case class dialer_cdr.tests.NewfiesAdminInterfaceTestCase(methodName=’runTest’) Test cases for Newfies Admin Interface. setUp() To create admin user test_admin_index() Test Function to check Admin index page test_admin_newfies() Test Function to check Newfies Admin pages 6.9.5 Customer Interface Test Case class dialer_cdr.tests.NewfiesCustomerInterfaceTestCase(methodName=’runTest’) Test cases for Newfies Customer Interface. 76 Chapter 6. Developer doc
  • 81. Newfies-Dialer Documentation, Release 1.1.0 test_campaign_view() Test Function to check campaign test_contact_view() Test Function to check Contact test_dashboard() Test Function to check customer dashboard test_index() Test Function to check customer index page test_phonebook_view() Test Function to check phonebook test_survey_view() Test Function survey view test_user_settings() Test Function to check User settings test_voiceapp_view() Test Function to check voiceapp test_voip_call_report() Test Function to check VoIP call report 6.9.6 Customer Interface Forgot Test Case class dialer_cdr.tests.NewfiesCustomerInterfaceForgotPassTestCase(methodName=’runTest’) Test cases for Newfies Customer Interface. for forgot password test_check_password_reset() Test Function to check password reset 6.9. Test Case Descriptions 77
  • 82. Newfies-Dialer Documentation, Release 1.1.0 78 Chapter 6. Developer doc
  • 83. CHAPTER SEVEN API REFERENCE Contents: 7.1 CampaignResource class api.resources.CampaignResource(api_name=None) Attributes: •campaign_code - Autogenerate campaign code •name - Name of the Campaign •description - Short description of the Campaign •callerid - Caller ID •startingdate - Start date. Epoch Time, ie 1301414368 •expirationdate - Expiry date. Epoch Time, ie 1301414368 •daily_start_time - Daily start time, default ‘00:00:00’ •daily_stop_time - Daily stop time, default ‘23:59:59’ •monday - Set to 1 if you want to run this day of the week, default ‘1’ •tuesday - Set to 1 if you want to run this day of the week, default ‘1’ •wednesday - Set to 1 if you want to run this day of the week , default ‘1’ •thursday - Set to 1 if you want to run this day of the week, default ‘1’ •friday - Set to 1 if you want to run this day of the week, default ‘1’ •saturday - Set to 1 if you want to run this day of the week, default ‘1’ •sunday - Set to 1 if you want to run this day of the week, default ‘1’ Campaign Settings: •frequency - Defines the frequency, speed of the campaign. This is the number of calls per minute. •callmaxduration - Maximum call duration. •maxretry - Defines the max retries allowed per user. •intervalretry - Defines the time to wait between retries in seconds •calltimeout - Defines the number of seconds to timeout on calls 79
  • 84. Newfies-Dialer Documentation, Release 1.1.0 Gateways: •aleg_gateway - Defines the Gateway to use to call the subscriber •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 •extra_data - Defines the additional data to pass to the application Validation: •CampaignValidation() Create: CURL Usage: curl -u username:password --dump-header - -H "Content-Type:application/json" -X POST --data Response: HTTP/1.0 200 OK Date: Thu, 08 Dec 2011 13:05:50 GMT Server: WSGIServer/0.1 Python/2.7.1+ Vary: Accept-Language, Cookie Content-Type: text/html; charset=utf-8 Location: http://localhost:8000/api/app/campaign/1/ Content-Language: en-us Read: CURL Usage: curl -u username:password -H ’Accept: application/json’ http://localhost:8000/api/v1/campaig Response: { "meta":{ "limit":20, "next":null, "offset":0, "previous":null, "total_count":1 }, "objects":[ { "callerid":"123987", "callmaxduration":1800, "calltimeout":45, "campaign_code":"XIUER", "created_date":"2011-06-15T00:49:16", "daily_start_time":"00:00:00", "daily_stop_time":"23:59:59", "description":"", "expirationdate":"2011-06-22T00:01:15", "extra_data":"", "frequency":10, "friday":true, "id":"1", "intervalretry":3, 80 Chapter 7. API Reference
  • 85. Newfies-Dialer Documentation, Release 1.1.0 "maxretry":3, "monday":true, "name":"Default_Campaign", "resource_uri":"/api/app/campaign/1/", "saturday":true, "startingdate":"2011-06-15T00:01:15", "status":1, "sunday":true, "thursday":true, "tuesday":true, "updated_date":"2011-06-15T00:49:16", "content_type":"/api/v1/contrib/contenttype/1/", "object_id":1, "wednesday":true } ] } Update: CURL Usage: curl -u username:password --dump-header - -H "Content-Type: application/json" -X PUT --data Response: HTTP/1.0 204 NO CONTENT Date: Fri, 23 Sep 2011 06:46:12 GMT Server: WSGIServer/0.1 Python/2.7.1+ Vary: Accept-Language, Cookie Content-Length: 0 Content-Type: text/html; charset=utf-8 Content-Language: en-us Delete: CURL Usage: curl -u username:password --dump-header - -H "Content-Type: application/json" -X DELETE htt curl -u username:password --dump-header - -H "Content-Type: application/json" -X DELETE htt Response: HTTP/1.0 204 NO CONTENT Date: Fri, 23 Sep 2011 06:48:03 GMT Server: WSGIServer/0.1 Python/2.7.1+ Vary: Accept-Language, Cookie Content-Length: 0 Content-Type: text/html; charset=utf-8 Content-Language: en-us Search: CURL Usage: curl -u username:password -H ’Accept: application/json’ http://localhost:8000/api/v1/campaig Response: 7.1. CampaignResource 81
  • 86. Newfies-Dialer Documentation, Release 1.1.0 { "meta":{ "limit":20, "next":null, "offset":0, "previous":null, "total_count":1 }, "objects":[ { "aleg_gateway":{ "created_date":"2011-06-15T00:28:52", "description":"", "id":"1", "maximum_call":null, "name":"Default_Gateway", }, "callerid":"1239876", "callmaxduration":50, "calltimeout":45, "campaign_code":"DJZVK", "created_date":"2011-10-13T02:06:22", "daily_start_time":"00:00:00", "daily_stop_time":"23:59:59", "description":"", "expirationdate":"2011-03-28T17:08:56", "extra_data":"2000", "frequency":20, "friday":true, "id":"16", "intervalretry":3000, "maxretry":3, "monday":true, "name":"mycampaign2", "resource_uri":"/api/v1/campaign/16/", "saturday":true, "startingdate":"2011-03-29T09:48:56", "status":2, "sunday":true, "thursday":true, "tuesday":true, "updated_date":"2011-10-13T02:06:22", "user":{ "id":"1", "username":"areski" }, "content_type":"/api/v1/contrib/contenttype/1/", "object_id":1, "wednesday":true } ] } 82 Chapter 7. API Reference
  • 87. Newfies-Dialer Documentation, Release 1.1.0 7.2 CampaignDeleteCascadeResource class api.resources.CampaignDeleteCascadeResource(api_name=None) Attributes: •campaign_id - Campaign ID CURL Usage: curl -u username:password --dump-header - -H "Content-Type: application/json" -X DELETE http:// Example Response: HTTP/1.0 204 NO CONTENT Date: Wed, 18 May 2011 13:23:14 GMT Server: WSGIServer/0.1 Python/2.6.2 Vary: Authorization Content-Length: 0 Content-Type: text/plain 7.3 PhonebookResource class api.resources.PhonebookResource(api_name=None) Attributes: •name - Name of the Phonebook •description - Short description of the Campaign •campaign_id - Campaign ID Validation: •PhonebookValidation() Create: CURL Usage: curl -u username:password --dump-header - -H "Content-Type:application/json" -X POST --data Response: HTTP/1.0 201 CREATED Date: Fri, 23 Sep 2011 06:08:34 GMT Server: WSGIServer/0.1 Python/2.7.1+ Vary: Accept-Language, Cookie Content-Type: text/html; charset=utf-8 Location: http://localhost:8000/api/app/phonebook/1/ Content-Language: en-us Read: CURL Usage: curl -u username:password -H ’Accept: application/json’ http://localhost:8000/api/v1/phonebo Response: 7.2. CampaignDeleteCascadeResource 83
  • 88. Newfies-Dialer Documentation, Release 1.1.0 { "meta":{ "limit":20, "next":null, "offset":0, "previous":null, "total_count":1 }, "objects":[ { "created_date":"2011-04-08T07:55:05", "description":"This is default phone book", "id":"1", "name":"Default_Phonebook", "resource_uri":"/api/v1/phonebook/1/", "updated_date":"2011-04-08T07:55:05", "user":{ "first_name":"", "id":"1", "last_login":"2011-10-11T01:03:42", "last_name":"", "resource_uri":"/api/v1/user/1/", "username":"areski" } } ] } Update: CURL Usage: curl -u username:password --dump-header - -H "Content-Type: application/json" -X PUT --data Response: HTTP/1.0 204 NO CONTENT Date: Fri, 23 Sep 2011 06:46:12 GMT Server: WSGIServer/0.1 Python/2.7.1+ Vary: Accept-Language, Cookie Content-Length: 0 Content-Type: text/html; charset=utf-8 Content-Language: en-us Delete: CURL Usage: curl -u username:password --dump-header - -H "Content-Type: application/json" -X DELETE htt curl -u username:password --dump-header - -H "Content-Type: application/json" -X DELETE htt Response: HTTP/1.0 204 NO CONTENT Date: Fri, 23 Sep 2011 06:48:03 GMT Server: WSGIServer/0.1 Python/2.7.1+ Vary: Accept-Language, Cookie Content-Length: 0 84 Chapter 7. API Reference
  • 89. Newfies-Dialer Documentation, Release 1.1.0 Content-Type: text/html; charset=utf-8 Content-Language: en-us Search: CURL Usage: curl -u username:password -H ’Accept: application/json’ http://localhost:8000/api/v1/phonebo 7.4 BulkContactResource class api.resources.BulkContactResource(api_name=None) API to bulk create contacts Attributes •contact - contact number of the Subscriber •phonebook_id - the phonebook Id to which we want to add the contact Validation: •BulkContactValidation() CURL Usage: curl -u username:password --dump-header - -H "Content-Type:application/json" -X POST --data ’{"p Response: HTTP/1.0 201 CREATED Date: Thu, 13 Oct 2011 11:42:44 GMT Server: WSGIServer/0.1 Python/2.7.1+ Vary: Accept-Language, Cookie Content-Type: text/html; charset=utf-8 Location: http://localhost:8000/api/v1/bulkcontact/None/ Content-Language: en-us 7.5 CampaignSubscriberResource class api.resources.CampaignSubscriberResource(api_name=None) Attributes Details: •contact - contact number of the Subscriber •last_name - last name of the Subscriber •first_name - first name of the Subscriber •email - email id of the Subscriber •description - Short description of the Subscriber •additional_vars - Additional settings for the Subscriber •phonebook_id - the phonebook Id to which we want to add the Subscriber Validation: •CampaignSubscriberValidation() 7.4. BulkContactResource 85
  • 90. Newfies-Dialer Documentation, Release 1.1.0 Create: CURL Usage: curl -u username:password --dump-header - -H "Content-Type:application/json" -X POST --data Response: HTTP/1.0 204 NO CONTENT Date: Wed, 18 May 2011 13:23:14 GMT Server: WSGIServer/0.1 Python/2.6.2 Vary: Authorization Content-Length: 0 Content-Type: text/plain Read: CURL Usage: curl -u username:password -H ’Accept: application/json’ http://localhost:8000/api/v1/campaig or curl -u username:password -H ’Accept: application/json’ http://localhost:8000/api/v1/campaig Response: Update: CURL Usage: curl -u username:password --dump-header - -H "Content-Type: application/json" -X PUT --data Response: HTTP/1.0 204 NO CONTENT Date: Fri, 23 Sep 2011 06:46:12 GMT Server: WSGIServer/0.1 Python/2.7.1+ Vary: Accept-Language, Cookie Content-Length: 0 Content-Type: text/html; charset=utf-8 Content-Language: en-us 7.6 CallrequestResource class api.resources.CallrequestResource(api_name=None) Attributes: •request_uuid - Unique id •call_time - Total call time •call_type - Call type •status - Call request status •callerid - Caller ID •callrequest_id- Callrequest Id •timeout - 86 Chapter 7. API Reference
  • 91. Newfies-Dialer Documentation, Release 1.1.0 •timelimit - •status - •campaign_subscriber - •campaign - •phone_number - •extra_dial_string - •extra_data - •num_attempt - •last_attempt_time - •result - •hangup_cause - •last_attempt_time - 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 Validation: •CallrequestValidation() Create: CURL Usage: curl -u username:password --dump-header - -H "Content-Type:application/json" -X POST --data Response: HTTP/1.0 201 CREATED Date: Fri, 23 Sep 2011 06:08:34 GMT Server: WSGIServer/0.1 Python/2.7.1+ Vary: Accept-Language, Cookie Content-Type: text/html; charset=utf-8 Location: http://localhost:8000/api/app/campaign/1/ Content-Language: en-us Read: CURL Usage: curl -u username:password -H ’Accept: application/json’ http://localhost:8000/api/v1/callreq curl -u username:password -H ’Accept: application/json’ http://localhost:8000/api/v1/callreq Response: { "meta":{ "limit":20, "next":null, "offset":0, 7.6. CallrequestResource 87
  • 92. Newfies-Dialer Documentation, Release 1.1.0 "previous":null, "total_count":1 }, "objects":[ { "call_time":"2011-10-20T12:21:22", "call_type":1, "callerid":"650784355", "created_date":"2011-10-14T07:33:41", "extra_data":"", "extra_dial_string":"", "hangup_cause":"", "id":"1", "last_attempt_time":null, "num_attempt":0, "phone_number":"8792749823", "request_uuid":"2342jtdsf-00123", "resource_uri":"/api/v1/callrequest/1/", "result":"", "status":1, "timelimit":3600, "timeout":30000, "updated_date":"2011-10-14T07:33:41", "user":{ "first_name":"", "id":"1", "last_login":"2011-10-11T01:03:42", "last_name":"", "resource_uri":"/api/v1/user/1/", "username":"areski" }, } ] } Update: CURL Usage: curl -u username:password --dump-header - -H "Content-Type: application/json" -X PUT --data Response: HTTP/1.0 204 NO CONTENT Date: Fri, 23 Sep 2011 06:46:12 GMT Server: WSGIServer/0.1 Python/2.7.1+ Vary: Accept-Language, Cookie Content-Length: 0 Content-Type: text/html; charset=utf-8 Content-Language: en-us 7.7 CdrResource class api.resources.CdrResource(api_name=None) Attributes: •cdr - XML string assigned from the Telephony engine 88 Chapter 7. API Reference
  • 93. Newfies-Dialer Documentation, Release 1.1.0 Validation: •CdrValidation() Create: CURL Usage: curl -u username:password --dump-header - -H "Content-Type:application/json" -X POST --data Response: HTTP/1.0 201 CREATED Date: Fri, 23 Sep 2011 06:08:34 GMT Server: WSGIServer/0.1 Python/2.7.1+ Vary: Accept-Language, Cookie Content-Type: text/html; charset=utf-8 Location: http://localhost:8000/api/v1/store_cdr/None/ Content-Language: en-us 7.8 AnswercallResource class api.resources.AnswercallResource(api_name=None) Attributes: •RequestUUID - A unique identifier for the API request. Create: CURL Usage: curl -u username:password --dump-header - -H "Content-Type:application/json" -X POST --data Response: HTTP/1.0 200 OK Date: Tue, 01 Nov 2011 11:30:59 GMT Server: WSGIServer/0.1 Python/2.7.1+ Vary: Accept-Language, Cookie Content-Type: application/json Content-Language: en-us <?xml version="1.0" encoding="utf-8"?> <Response> <Dial timeLimit="3600" callerId="650784355"> <Number gateways="user/,user" gatewayTimeouts="30000"></Number> </Dial> </Response> 7.9 HangupcallResource class api.resources.HangupcallResource(api_name=None) Attributes: •RequestUUID - RequestUUID •HangupCause - Hangup Cause 7.8. AnswercallResource 89
  • 94. Newfies-Dialer Documentation, Release 1.1.0 Create: CURL Usage: curl -u username:password --dump-header - -H "Content-Type:application/json" -X POST --data Response: HTTP/1.0 200 OK Date: Tue, 01 Nov 2011 12:04:35 GMT Server: WSGIServer/0.1 Python/2.7.1+ Vary: Accept-Language, Cookie Content-Type: application/json Content-Language: en-us <?xml version="1.0" encoding="utf-8"?> <Response> </Response> 7.10 SurveyAppResource class survey.api.resources.SurveyAppResource(api_name=None) Attributes: •name - survey name •description - •user_id - User ID Validation: •SurveyAppValidation() Create: CURL Usage: curl -u username:password --dump-header - -H "Content-Type:application/json" -X POST --data Response: HTTP/1.0 201 CREATED Date: Fri, 23 Sep 2011 06:08:34 GMT Server: WSGIServer/0.1 Python/2.7.1+ Vary: Accept-Language, Cookie Content-Type: text/html; charset=utf-8 Location: http://localhost:8000/api/v1/survey/1/ Content-Language: en-us Read: CURL Usage: curl -u username:password -H ’Accept: application/json’ http://localhost:8000/api/v1/survey/ Response: { "meta":{ "limit":20, 90 Chapter 7. API Reference
  • 95. Newfies-Dialer Documentation, Release 1.1.0 "next":null, "offset":0, "previous":null, "total_count":1 }, "objects":[ { "created_date":"2011-04-08T07:55:05", "description":"This is default phone book", "id":"1", "name":"survey name", "resource_uri":"/api/v1/survey/1/", "updated_date":"2011-04-08T07:55:05", "user":{ "first_name":"", "id":"1", "last_login":"2011-10-11T01:03:42", "last_name":"", "resource_uri":"/api/v1/user/1/", "username":"areski" } } ] } Update: CURL Usage: curl -u username:password --dump-header - -H "Content-Type: application/json" -X PUT --data Response: HTTP/1.0 204 NO CONTENT Date: Fri, 23 Sep 2011 06:46:12 GMT Server: WSGIServer/0.1 Python/2.7.1+ Vary: Accept-Language, Cookie Content-Length: 0 Content-Type: text/html; charset=utf-8 Content-Language: en-us Delete: CURL Usage: curl -u username:password --dump-header - -H "Content-Type: application/json" -X DELETE htt curl -u username:password --dump-header - -H "Content-Type: application/json" -X DELETE htt Response: HTTP/1.0 204 NO CONTENT Date: Fri, 23 Sep 2011 06:48:03 GMT Server: WSGIServer/0.1 Python/2.7.1+ Vary: Accept-Language, Cookie Content-Length: 0 Content-Type: text/html; charset=utf-8 Content-Language: en-us 7.10. SurveyAppResource 91
  • 96. Newfies-Dialer Documentation, Release 1.1.0 7.11 SurveyQuestionResource class survey.api.resources.SurveyQuestionResource(api_name=None) Attributes: •question - survey question •user - User ID •surveyapp - surveyapp ID •audio_message - audio file •message_type - Audio / Text2Speech Validation: •SurveyQuestionValidation() Create: CURL Usage: curl -u username:password --dump-header - -H "Content-Type:application/json" -X POST --data Response: HTTP/1.0 201 CREATED Date: Fri, 23 Sep 2011 06:08:34 GMT Server: WSGIServer/0.1 Python/2.7.1+ Vary: Accept-Language, Cookie Content-Type: text/html; charset=utf-8 Location: http://localhost:8000/api/v1/survey_question/1/ Content-Language: en-us Read: CURL Usage: curl -u username:password -H ’Accept: application/json’ http://localhost:8000/api/v1/survey_ Response: { "meta":{ "limit":20, "next":null, "offset":0, "previous":null, "total_count":2 }, "objects":[ { "created_date":"2011-12-15T13:10:49", "id":"1", "message_type":1, "order":1, "question":"Test Servey Qus", "resource_uri":"/api/v1/survey_question/1/", "surveyapp":{ "created_date":"2011-12-15T09:55:25", "description":"", 92 Chapter 7. API Reference
  • 97. Newfies-Dialer Documentation, Release 1.1.0 "id":"5", "name":"new test", "order":2, "resource_uri":"/api/v1/survey/5/", "updated_date":"2011-12-15T09:55:25", "user":{ "first_name":"", "id":"1", "last_login":"2011-12-14T07:26:00", "last_name":"", "resource_uri":"/api/v1/user/1/", "username":"areski" } }, "tags":"", "updated_date":"2011-12-15T13:10:49", "user":{ "first_name":"", "id":"1", "last_login":"2011-12-14T07:26:00", "last_name":"", "resource_uri":"/api/v1/user/1/", "username":"areski" } }, ] } Update: CURL Usage: curl -u username:password --dump-header - -H "Content-Type: application/json" -X PUT --data Response: HTTP/1.0 204 NO CONTENT Date: Fri, 23 Sep 2011 06:46:12 GMT Server: WSGIServer/0.1 Python/2.7.1+ Vary: Accept-Language, Cookie Content-Length: 0 Content-Type: text/html; charset=utf-8 Content-Language: en-us Delete: CURL Usage: curl -u username:password --dump-header - -H "Content-Type: application/json" -X DELETE htt curl -u username:password --dump-header - -H "Content-Type: application/json" -X DELETE htt Response: HTTP/1.0 204 NO CONTENT Date: Fri, 23 Sep 2011 06:48:03 GMT Server: WSGIServer/0.1 Python/2.7.1+ Vary: Accept-Language, Cookie Content-Length: 0 7.11. SurveyQuestionResource 93
  • 98. Newfies-Dialer Documentation, Release 1.1.0 Content-Type: text/html; charset=utf-8 Content-Language: en-us 7.12 SurveyResponseResource class survey.api.resources.SurveyResponseResource(api_name=None) Attributes: •key - survey question’s response key •key value - response key value •surveyquestion - survey question ID Validation: •SurveyResponseValidation() Create: CURL Usage: curl -u username:password --dump-header - -H "Content-Type:application/json" -X POST --data Response: HTTP/1.0 201 CREATED Date: Fri, 23 Sep 2011 06:08:34 GMT Server: WSGIServer/0.1 Python/2.7.1+ Vary: Accept-Language, Cookie Content-Type: text/html; charset=utf-8 Location: http://localhost:8000/api/v1/survey_response/1/ Content-Language: en-us Read: CURL Usage: curl -u username:password -H ’Accept: application/json’ http://localhost:8000/api/v1/survey_ Response: { "meta":{ "limit":20, "next":null, "offset":0, "previous":null, "total_count":1 }, "objects":[ { "created_date":"2011-12-15T14:54:50", "id":"3", "key":"YES", "keyvalue":"1", "resource_uri":"/api/v1/survey_response/3/", "surveyquestion":{ "created_date":"2011-12-15T13:10:49", "id":"17", 94 Chapter 7. API Reference
  • 99. Newfies-Dialer Documentation, Release 1.1.0 "message_type":1, "order":1, "question":"Servey Qus", "resource_uri":"/api/v1/survey_question/17/", "surveyapp":{ "created_date":"2011-12-15T09:55:25", "description":"", "id":"5", "name":"new test", "order":2, "resource_uri":"/api/v1/survey/5/", "updated_date":"2011-12-15T14:45:46", "user":{ "first_name":"", "id":"1", "last_login":"2011-12-14T07:26:00", "last_name":"", "resource_uri":"/api/v1/user/1/", "username":"areski" } }, "tags":"", "updated_date":"2011-12-15T13:10:49", "user":{ "first_name":"", "id":"1", "last_login":"2011-12-14T07:26:00", "last_name":"", "resource_uri":"/api/v1/user/1/", "username":"areski" } }, "updated_date":"2011-12-15T14:54:50" } ] } Update: CURL Usage: curl -u username:password --dump-header - -H "Content-Type: application/json" -X PUT --data Response: HTTP/1.0 204 NO CONTENT Date: Fri, 23 Sep 2011 06:46:12 GMT Server: WSGIServer/0.1 Python/2.7.1+ Vary: Accept-Language, Cookie Content-Length: 0 Content-Type: text/html; charset=utf-8 Content-Language: en-us Delete: CURL Usage: curl -u username:password --dump-header - -H "Content-Type: application/json" -X DELETE htt curl -u username:password --dump-header - -H "Content-Type: application/json" -X DELETE htt 7.12. SurveyResponseResource 95
  • 100. Newfies-Dialer Documentation, Release 1.1.0 Response: HTTP/1.0 204 NO CONTENT Date: Fri, 23 Sep 2011 06:48:03 GMT Server: WSGIServer/0.1 Python/2.7.1+ Vary: Accept-Language, Cookie Content-Length: 0 Content-Type: text/html; charset=utf-8 Content-Language: en-us 96 Chapter 7. API Reference
  • 101. CHAPTER EIGHT CONTRIBUTING • Community Code of Conduct • Reporting a Bug • Coding Style 8.1 Community Code of Conduct Members of our community need to work together effectively, and this code of conduct lays down the ground rules for our cooperation. Please read the following documentation about how the Newfies-Dialer Project functions, coding styles expected for contributions, and the community standards we expect everyone to abide by. The Code of Conduct is heavily based on the Ubuntu Code of Conduct, Celery Code of Conduct, and the Pylons Code of Conduct. 8.1.1 Be considerate. Your work will be used by other people, and you in turn will depend on the work of others. Any decision you take will affect users and colleagues, and we expect you to take those consequences into account when making decisions. Even if it’s not obvious at the time, our contributions to Newfies-Dialer will impact the work of others. For example, changes to code, infrastructure, policy, documentation and translations during a release may negatively impact others work. 8.1.2 Be respectful. The Newfies-Dialer community and its members treat one another with respect. Everyone can make a valuable con- tribution to Newfies-Dialer. We may not always agree, but disagreement is no excuse for poor behaviour and bad manners. We might all experience some frustration now and then, but we cannot allow that frustration to turn into a personal attack. It’s important to remember that a community where people feel uncomfortable or threatened is not a productive one. We expect members of the Newfies-Dialer community to be respectful when dealing with other contributors as well as with people outside the Newfies-Dialer project and with users of Newfies-Dialer. 97
  • 102. Newfies-Dialer Documentation, Release 1.1.0 8.1.3 Be collaborative. Collaboration is central to Newfies-Dialer and to the larger free software community. We should always be open to collaboration. Your work should be done transparently and patches from Newfies-Dialer should be given back to the community when they are made, not just when the distribution is released. If you wish to work on new code for existing upstream projects, at least keep those projects informed of your ideas and progress. It many not be possible to get consensus from upstream, or even from your colleagues about the correct implementation for an idea, so don’t feel obliged to have that agreement before you begin, but at least keep the outside world informed of your work, and publish your work in a way that allows outsiders to test, discuss and contribute to your efforts. 8.1.4 When you disagree, consult others. Disagreements, both political and technical, happen all the time and the Newfies-Dialer community is no exception. It is important that we resolve disagreements and differing views constructively and with the help of the community and community process. If you really want to go a different way, then we encourage you to make a derivative distribution or alternate set of packages that still build on the work we’ve done to utilise as common a core as possible. 8.1.5 When you are unsure, ask for help. Nobody knows everything, and nobody is expected to be perfect. Asking questions avoids many problems down the road, and so questions are encouraged. Those who are asked questions should be responsive and helpful. However, when asking a question, care must be taken to do so in an appropriate forum. 8.1.6 Step down considerately. Developers on every project come and go and Newfies-Dialer is no different. When you leave or disengage from the project, in whole or in part, we ask that you do so in a way that minimises disruption to the project. This means you should tell people you are leaving and take the proper steps to ensure that others can pick up where you leave off. 8.2 Reporting a Bug Bugs can always be described to the Mailing list, but the best way to report an issue and to ensure a timely response is to use the issue tracker. 1. Create a GitHub account. You need to create a GitHub account to be able to create new issues and participate in the discussion. 2. Determine if your bug is really a bug. You should not file a bug if you are requesting support. For that you can use the Mailing list. 3. Make sure your bug hasn’t already been reported. Search through the appropriate Issue tracker. If a bug like yours was found, check if you have new information that could be reported to help the developers fix the bug. 4. Collect information about the bug. To have the best chance of having a bug fixed, we need to be able to easily reproduce the conditions that caused it. Most of the time this information will be from a Python traceback message, though some bugs might be in design, spelling or other errors on the website/docs/code. If the error is from a Python traceback, include it in the bug report. 98 Chapter 8. Contributing
  • 103. Newfies-Dialer Documentation, Release 1.1.0 We also need to know what platform you’re running (Windows, OSX, Linux, etc), the version of your Python inter- preter, the version of Newfies-Dialer and related packages that you were running when the bug occurred. 5. Submit the bug. By default GitHub will email you to let you know when new comments have been made on your bug. In the event you’ve turned this feature off, you should check back on occasions to ensure you don’t miss any questions a developer trying to fix the bug might ask. 8.2.1 Issue Trackers Bugs for a package in the Newfies-Dialer ecosystem should be reported to the relevant issue tracker. • Newfies-Dialer: http://github.com/Star2Billing/newfies-dialer/issues/ • Celery: https://github.com/ask/celery/issues/ • Freeswitch: http://jira.freeswitch.org/secure/Dashboard.jspa • Plivo: https://github.com/plivo/plivo/issues/ If you are unsure of the origin of the bug you can ask the Mailing list, or just use the Newfies-Dialer issue tracker. 8.3 Coding Style You should probably be able to pick up the coding style from surrounding code, but it is a good idea to be aware of the following conventions. • All Python code must follow the PEP-8 guidelines. pep8.py is a utility you can use to verify that your code is following the conventions. • Docstrings must follow the PEP-257 conventions, and use the following style. Do this: def method(self, arg): """Short description. More details. """ or: def method(self, arg): """Short description.""" but not this: def method(self, arg): """ Short description. """ • Lines should not exceed 78 columns. • Wildcard imports must not be used (from xxx import *). 8.3. Coding Style 99
  • 104. Newfies-Dialer Documentation, Release 1.1.0 100 Chapter 8. Contributing
  • 105. CHAPTER NINE FREQUENTLY ASKED QUESTIONS • General • Misconceptions 9.1 General 9.1.1 What is Newfies-Dialer? Answer: . Newfies-Dialer is a voice broadcast application designed and built to automate the delivery of interactive phone calls to contacts, clients and the general public. 9.1.2 Why should I use Newfies-Dialer? Answer: . Below are some examples of some of the uses that Newfies-Dialer can be put to. There are more details and examples at http://www.newfies-dialer.org/solutions/ • Telecasting: Broadcast marketing or informational messages to customers and clients. • Telemarketing: Broadcast a marketing message to potential customers, and give them the option to be put through • Phone Polling, Surveys and Voting: Ring large numbers of people and present IVR options for either polling their opinions, interact • Debt Control: Customers can be automatically reminded at intervals that they owe money, and an IVR menu presen • Appointment reminders: Doctors, Dentists, and other organisations that make appointments for their clients can integrat 101
  • 106. Newfies-Dialer Documentation, Release 1.1.0 • Dissemination of Information by Phone: Newfies-Dialer was originally designed to call large numbers of people and disseminate medical a • Mass Emergency Broadcasting: Where there is a necessity to warn large numbers of people in a short space of time, such as wea • Voice Conferencing: Attendees for a voice conference or podcast can be dialled up from a central location, and be co • Subscription Reminders and Renewals: Where a company sells an annual subscription for a product or service, Newfies-Dialer can be con 9.1.3 What’s the history behind Newfies-Dialer? Answer: . Newfies-Dialer is a bulk dialer application which was commissioned by a charity named Ku- batana (http://www.kubatana.net) based in Zimbabwe, which sponsors the Freedomfone project (http://www.freedomfone.org/) dedicated to providing information via phone technology. In less economically developed countries, Internet is often limited, but there is usually comprehensive mobile phone coverage. Freedomfone uses Newfies-Dialer to dial up people’s phones and offer health information on Cholera, Malaria and so many other avoidable health issues in the third world, which may be alleviated by education. Newfies- Dialer was so named after the Newfoundland Dog nicknamed Newfies and used by sea rescue services around the world. 9.2 Misconceptions 9.2.1 Is Newfies-Dialer dependent on Celery? Answer: Yes. 102 Chapter 9. Frequently Asked Questions
  • 107. CHAPTER TEN TROUBLESHOOTING • Where to find help • Where to find the log files • How to run a quick test call • Run in debug mode • Celerymon • How to discard all pending tasks • Checking Plivo is running • Checking Freeswitch • Step By Step Checklist 10.1 Where to find help 10.1.1 Documentation: http://www.newfies-dialer.org/documentation/ 10.1.2 Mailing list: We have set up a mailing list at http://groups.google.com/group/newfies-dialer 10.1.3 Forum: We have a forum at http://forum.newfies-dialer.org/ 10.1.4 Support: Star2Billing S.L. offers consultancy including installation, training and customisation 10.2 Where to find the log files All the logs are centralized into one single directory /var/log/newfies/ 103
  • 108. Newfies-Dialer Documentation, Release 1.1.0 newfies-django-db.log : This contains all the Database queries performed by the UI newfies-django.log : All the logger events from Django err-apache-newfies.log : Any apache errors pertaining to Newfies-Dialer celery-newfies-node1.log : This contains celery activity 10.3 How to run a quick test call Go on the admin panel and check if there is any call request that has been spooled. • http://your-ip:8008/admin/dialer_cdr/callrequest/ If there are no calls queued, this means that the campaign is not properly configured. You should: 1. Check if the campaign is started that the “Start time”, “Finish Time” and server time are correct. 2. Make sure that you configured a Dialer Setting for the user running the campaign, although there will be a warning for this on the Customer UI : http://your-ip:8008/admin/dialer_settings/dialersetting/ If there is an existing Call Request, check the status, and check the Celery log stored in /var/log/newfies 10.4 Run in debug mode Make sure you stop the services first: $ /etc/init.d/newfies-celeryd stop Then run in debug mode: $ workon newfies-dialer $ cd /usr/share/newfies/ $ python manage.py celeryd -EB --loglevel=DEBUG 10.5 Celerymon • https://github.com/ask/celerymon Running the monitor : Start celery with the –events option on, so celery sends events for celerymon to capture:: $ workon newfies- dialer $ cd /usr/share/newfies/ $ python manage.py celeryd -E Run the monitor server: $ workon newfies-dialer $ cd /usr/share/newfies/ $ python manage.py celerymon However, in production you probably want to run the monitor in the background, as a daemon: $ workon newfies-dialer $ cd /usr/share/newfies/ $ python manage.py celerymon --detach 104 Chapter 10. Troubleshooting
  • 109. Newfies-Dialer Documentation, Release 1.1.0 For a complete listing of the command line arguments available, with a short description, you can use the help com- mand: $ workon newfies-dialer $ cd /usr/share/newfies/ $ python manage.py help celerymon Now you can visit the webserver celerymon starts by going to: http://localhost:8989 10.6 How to discard all pending tasks http://docs.celeryproject.org/en/latest/faq.html?highlight=purge#how-do-i-discard-all-waiting-tasks 10.7 Checking Plivo is running At the command line, type: $ ps aux | grep plivo This should tell you that Plivo-rest, Plivo-Outbound and Plivo-cache are all running. If they are not, these services can be restarted with the following commands: $ /etc/init.d/plivo stop $ /etc/init.d/plivocache stop $ /etc/init.d/plivo start $ /etc/init.d/plivocache start If there are still issues with Plivo, then check the logs for clues at /usr/share/plivo/tmp/ 10.8 Checking Freeswitch Entering the Freeswitch CLI shold indicate whether it is running by typing fs_cli at the console. Once logged in, you can check the trunk registration by typing sofia status at the Freeswitch CLI. CTRL-D exits the Freeswitch CLI. If the Freeswitch CLI cannot be launched, then the status of freeswitch can be checked with: $ ps aux | grep freeswitch or $ /etc/init.d/freeswitch status If Freeswitch is not running, then it can be started with $ /etc/init.d/freeswitch start 10.9 Step By Step Checklist The step by step checklist below should be used to validate that all components of the platform are running. User interface : • 1. Dialer Gateway matching a configured trunk is set up in the UI 10.6. How to discard all pending tasks 105
  • 110. Newfies-Dialer Documentation, Release 1.1.0 • 2. Dialer Settings configured and attached to the appropriate user • 3. Phonebook Created with contacts attached to the phonebook • 4. Configured voice application • 5. Campaign created, and started, with a phone book attached, and the campaign schedule current Backend : • 1. Celery Monitor Running • 2. Plivo Running • 3. Freeswitch running If there are still problems, then raise a support question on the mailing-list http://groups.google.com/group/newfies- dialer or our forum, http://forum.newfies-dialer.org/, alternatively, contact newfi[email protected] for com- mercial support. 106 Chapter 10. Troubleshooting
  • 111. CHAPTER ELEVEN RESOURCES • Getting Help – Mailing list • Bug tracker • Wiki • Contributing • License 11.1 Getting Help 11.1.1 Mailing list For discussions about the usage, development, and future of Newfies-Dialer, please join the Newfies-Dialer mailing list. 11.2 Bug tracker If you have any suggestions, bug reports or annoyances please report them to our issue tracker at https://github.com/Star2Billing/newfies-dialer/issues/ 11.3 Wiki https://github.com/Star2Billing/newfies-dialer/wiki/ 11.4 Contributing Development of Newfies-Dialer happens at Github: https://github.com/Star2Billing/newfies-dialer You are highly encouraged to participate in the development of Newfies-Dialer. If you would prefer not to use Github, you are welcome to send us regular patches Be sure to also read the Contributing section in the documentation. 107
  • 112. Newfies-Dialer Documentation, Release 1.1.0 11.5 License This software is licensed under the AGPL License. See the LICENSE file in the top distribution directory for the full license text. 108 Chapter 11. Resources
  • 113. CHAPTER TWELVE INDICES AND TABLES • genindex • modindex • search 109
  • 114. Newfies-Dialer Documentation, Release 1.1.0 110 Chapter 12. Indices and tables
  • 115. PYTHON MODULE INDEX a api.resources, 83 d dialer_campaign.admin, 71 dialer_campaign.models, 74 dialer_campaign.tasks, 73 dialer_campaign.views, 66 dialer_cdr.admin, 72 dialer_cdr.models, 63 dialer_cdr.tests, 75 dialer_gateway.admin, 73 dialer_gateway.models, 64 dialer_settings.admin, 73 dialer_settings.models, 65 s survey.api.resources, 94 u user_profile.models, 65 111
  • 116. Newfies-Dialer Documentation, Release 1.1.0 112 Python Module Index
  • 117. INDEX A changelist_view() (dialer_cdr.admin.VoIPCallAdmin add_view() (dialer_campaign.admin.CampaignAdmin method), 72 method), 71 changelist_view() (dialer_settings.admin.DialerSettingAdmin add_view() (dialer_campaign.admin.ContactAdmin method), 73 method), 72 check_campaign_pendingcall (class in di- add_view() (dialer_settings.admin.DialerSettingAdmin aler_campaign.tasks), 73 method), 73 collect_subscriber (class in dialer_campaign.tasks), 74 AnswercallResource (class in api.resources), 89 common_campaign_status() (in module di- api.resources (module), 79, 82, 83, 85, 86, 88, 89 aler_campaign.views), 68 common_send_notification() (in module di- B aler_campaign.views), 67 Contact (class in dialer_campaign.models), 60 BulkContactResource (class in api.resources), 85 contact_add() (in module dialer_campaign.views), 69 contact_change() (in module dialer_campaign.views), 70 C contact_grid() (in module dialer_campaign.views), 69 Callrequest (class in dialer_cdr.models), 63 contact_import() (in module dialer_campaign.views), 70 callrequest_pending (class in dialer_cdr.tasks), 74 contact_list() (in module dialer_campaign.views), 69 CallrequestAdmin (class in dialer_cdr.admin), 72 contact_name() (dialer_campaign.models.Contact CallrequestResource (class in api.resources), 86 method), 61 Campaign (class in dialer_campaign.models), 61 ContactAdmin (class in dialer_campaign.admin), 72 campaign_add() (in module dialer_campaign.views), 71 count_contact_of_phonebook() (di- campaign_change() (in module dialer_campaign.views), aler_campaign.models.Campaign method), 71 62 campaign_grid() (in module dialer_campaign.views), 70 cust_password_reset() (in module di- campaign_list() (in module dialer_campaign.views), 70 aler_campaign.views), 67 campaign_running (class in dialer_campaign.tasks), 73 cust_password_reset_confirm() (in module di- CampaignAdmin (class in dialer_campaign.admin), 71 aler_campaign.views), 67 CampaignDeleteCascadeResource (class in cust_password_reset_done() (in module di- api.resources), 83 aler_campaign.views), 67 CampaignManager (class in dialer_campaign.models), 61 customer_dashboard() (in module di- CampaignResource (class in api.resources), 79 aler_campaign.views), 66 CampaignSubscriber (class in dialer_campaign.models), 62 D campaignsubscriber_detail() (di- destination_name() (dialer_cdr.models.VoIPCall aler_campaign.models.Campaign method), method), 64 62 dialer_campaign.admin (module), 71 CampaignSubscriberAdmin (class in di- dialer_campaign.models (module), 60, 74 aler_campaign.admin), 72 dialer_campaign.tasks (module), 73 CampaignSubscriberResource (class in api.resources), 85 dialer_campaign.views (module), 66 CdrResource (class in api.resources), 88 dialer_cdr.admin (module), 72 change_view() (dialer_settings.admin.DialerSettingAdmin dialer_cdr.models (module), 63 method), 73 dialer_cdr.tests (module), 75 113
  • 118. Newfies-Dialer Documentation, Release 1.1.0 dialer_gateway.admin (module), 73 N dialer_gateway.models (module), 64 NewfiesAdminInterfaceTestCase (class in di- dialer_settings.admin (module), 73 aler_cdr.tests), 76 dialer_settings.models (module), 65 NewfiesCustomerInterfaceForgotPassTestCase (class in DialerSetting (class in dialer_settings.models), 65 dialer_cdr.tests), 77 DialerSettingAdmin (class in dialer_settings.admin), 73 NewfiesCustomerInterfaceTestCase (class in di- aler_cdr.tests), 76 E NewfiesTastypieApiTestCase (class in dialer_cdr.tests), export_voip_report() (dialer_cdr.admin.VoIPCallAdmin 75 method), 73 P G Phonebook (class in dialer_campaign.models), 60 Gateway (class in dialer_gateway.models), 64 phonebook_add() (in module dialer_campaign.views), 68 GatewayAdmin (class in dialer_gateway.admin), 73 phonebook_change() (in module dialer_campaign.views), get_active_callmaxduration() (di- 69 aler_campaign.models.Campaign method), phonebook_contacts() (di- 62 aler_campaign.models.Phonebook method), get_active_contact() (dialer_campaign.models.Campaign 60 method), 62 phonebook_grid() (in module dialer_campaign.views), 68 get_active_contact_no_subscriber() (di- phonebook_list() (in module dialer_campaign.views), 68 aler_campaign.models.Campaign method), PhonebookAdmin (class in dialer_campaign.admin), 71 62 PhonebookResource (class in api.resources), 83 get_active_max_frequency() (di- post_save_add_contact() (in module di- aler_campaign.models.Campaign method), aler_campaign.models), 74 62 progress_bar() (dialer_campaign.models.Campaign get_expired_campaign() (di- method), 62 aler_campaign.models.CampaignManager method), 61 S get_pending_subscriber() (di- setUp() (dialer_cdr.tests.NewfiesAdminInterfaceTestCase aler_campaign.models.Campaign method), method), 76 62 survey.api.resources (module), 90, 91, 94 get_running_campaign() (di- SurveyAppResource (class in survey.api.resources), 90 aler_campaign.models.CampaignManager SurveyQuestionResource (class in survey.api.resources), method), 61 92 SurveyResponseResource (class in survey.api.resources), H 94 HangupcallResource (class in api.resources), 89 has_add_permission() (dialer_cdr.admin.VoIPCallAdmin T method), 73 test_admin_index() (di- aler_cdr.tests.NewfiesAdminInterfaceTestCase I method), 76 import_contact() (dialer_campaign.admin.ContactAdmin test_admin_newfies() (di- method), 72 aler_cdr.tests.NewfiesAdminInterfaceTestCase index() (in module dialer_campaign.views), 66 method), 76 init_callrequest (class in dialer_cdr.tasks), 74 test_campaign_view() (di- is_authorized_contact() (di- aler_cdr.tests.NewfiesCustomerInterfaceTestCase aler_campaign.models.Campaign method), method), 76 62 test_check_password_reset() (di- aler_cdr.tests.NewfiesCustomerInterfaceForgotPassTestCase L method), 77 login_view() (in module dialer_campaign.views), 67 test_contact_view() (di- aler_cdr.tests.NewfiesCustomerInterfaceTestCase M method), 77 min_duration() (dialer_cdr.models.VoIPCall method), 64 114 Index
  • 119. Newfies-Dialer Documentation, Release 1.1.0 test_create_answercall() (di- test_read_phonebook() (di- aler_cdr.tests.NewfiesTastypieApiTestCase aler_cdr.tests.NewfiesTastypieApiTestCase method), 75 method), 76 test_create_bulk_contact() (di- test_read_survey() (dialer_cdr.tests.NewfiesTastypieApiTestCase aler_cdr.tests.NewfiesTastypieApiTestCase method), 76 method), 75 test_read_survey_question() (di- test_create_callrequest() (di- aler_cdr.tests.NewfiesTastypieApiTestCase aler_cdr.tests.NewfiesTastypieApiTestCase method), 76 method), 75 test_read_survey_response() (di- test_create_campaign() (di- aler_cdr.tests.NewfiesTastypieApiTestCase aler_cdr.tests.NewfiesTastypieApiTestCase method), 76 method), 75 test_survey_view() (di- test_create_campaign_subscriber() (di- aler_cdr.tests.NewfiesCustomerInterfaceTestCase aler_cdr.tests.NewfiesTastypieApiTestCase method), 77 method), 75 test_update_campaign() (di- test_create_cdr() (dialer_cdr.tests.NewfiesTastypieApiTestCase aler_cdr.tests.NewfiesTastypieApiTestCase method), 75 method), 76 test_create_hangupcall() (di- test_update_campaign_subscriber() (di- aler_cdr.tests.NewfiesTastypieApiTestCase aler_cdr.tests.NewfiesTastypieApiTestCase method), 75 method), 76 test_create_phonebook() (di- test_update_survey() (di- aler_cdr.tests.NewfiesTastypieApiTestCase aler_cdr.tests.NewfiesTastypieApiTestCase method), 75 method), 76 test_create_survey() (di- test_update_survey_question() (di- aler_cdr.tests.NewfiesTastypieApiTestCase aler_cdr.tests.NewfiesTastypieApiTestCase method), 75 method), 76 test_create_survey_question() (di- test_update_survey_response() (di- aler_cdr.tests.NewfiesTastypieApiTestCase aler_cdr.tests.NewfiesTastypieApiTestCase method), 75 method), 76 test_create_survey_response() (di- test_user_settings() (di- aler_cdr.tests.NewfiesTastypieApiTestCase aler_cdr.tests.NewfiesCustomerInterfaceTestCase method), 75 method), 77 test_dashboard() (dialer_cdr.tests.NewfiesCustomerInterfaceTestCase test_voiceapp_view() (di- method), 77 aler_cdr.tests.NewfiesCustomerInterfaceTestCase test_delete_campaign() (di- method), 77 aler_cdr.tests.NewfiesTastypieApiTestCase test_voip_call_report() (di- method), 75 aler_cdr.tests.NewfiesCustomerInterfaceTestCase test_delete_cascade_campaign() (di- method), 77 aler_cdr.tests.NewfiesTastypieApiTestCase method), 76 U test_index() (dialer_cdr.tests.NewfiesCustomerInterfaceTestCase update_campaign_status() (di- method), 77 aler_campaign.models.Campaign method), test_phonebook_view() (di- 62 aler_cdr.tests.NewfiesCustomerInterfaceTestCase used_gateway_link() (dialer_cdr.admin.VoIPCallAdmin method), 77 method), 73 test_read_callrequest() (di- user_link() (dialer_cdr.admin.VoIPCallAdmin method), aler_cdr.tests.NewfiesTastypieApiTestCase 73 method), 76 user_profile.models (module), 65 test_read_campaign() (di- UserProfile (class in user_profile.models), 65 aler_cdr.tests.NewfiesTastypieApiTestCase method), 76 V test_read_campaign_subscriber() (di- VoIPCall (class in dialer_cdr.models), 63 aler_cdr.tests.NewfiesTastypieApiTestCase VoIPCallAdmin (class in dialer_cdr.admin), 72 method), 76 Index 115