Wednesday, June 11, 2014

DiDi

DisAsterisk Dialer -DiDi- for Android.


This is a Tasker program to make calls via DisAsterisk automatically.
You initiate your calls in the default Dialer, but this DiDi application catches it and start a DisAsterisk Dialer call procedure.

DisAsterisk is the greatest project to make cheaper calls. See details here:
Github - Instantwater - Asterisk-disa-callback
and support forum here

Normal Dialer procedure.

Start Dialer and Type "B" number and push green "phone button" wait and if other side picked up then talk :)

DiDi - DisAsterisk Dial call procedure.


This procedure is automated by Tasker.

Step 1.

  1. Activate Disa caller. DiDi.  - Only ones needed, first activation.
  2. DiDi notification appears if active.
  3. Call your partner as usual: Via direct Call button or Dialer or Contacts or call history






Step 2. 


Call will catched by DiDi.



Didi ends the call, before real call started.




Step 3. 

  1. DiDi calls your DisAsterisk server's incoming number (Disa Trigger number)






2.  DisAsterisk will reject the call!   (no call cost because Busy tone)
Later it calls you back.


Step 4:

  1. After few seconds call is coming from DisAsterisk to your Mobile - 
  2. DiDi Takes the call.




Step 5:


    DisAsterisk give "dial tone" and waiting DTMF code for Quick Dial [1-9]
    OR [0] if normal number.

    DiDi Dials "0" and DTMF numbers and # at the end. 
    Some android device will not show Dial pad when DiDi enters numbers, the workaround is to 
    Emulate a touch event to show dialer pad.
    Run Shell
    input tap x,y
    Where xy is the coordinates of dialer pad button.


    After DiDi enters the numbers and # at the end, DisAsterisk calls that number and connect you through.

    DiDi dialed numbers appears duplicated, BUT it will send right DTMF code. So don't worries: Dialed number will be fine.

    Prerequisites

    1. Tasker needs rooted Android for some of this tasks.
    2. Enable Usb Debugging in Settings - Developer settings-

     Tasker implementation.

    Download:

    See exported XML tasks and Profiles. 
    Just import it to Tasker and update config files.



    My implementation takes three major parts.

    a.) Two Profiles:

    1. Call step 1: catch outgoing calls and replace to Disa call procedure.   (Catchoutcall)
    2. Call step 2: catch incoming calls if it comes from Disa.                     (CatchInIfDisa)

    b.) Three Tasks

    1. (Call step 1) Start Disa call Procedure when initiate a call with dialer.   (CallWithDisa)
    2. (Call step 2) Take call when Disa is calling you back.                           (TakeCall)
    3. One task to Activate (toggle) Disa Profile or normal Dialer mode.         (ActivateDidi)

    c.) Two Config files:

    1. One for Disa trigger number. (disatriggernum.txt )
    2. One for Disa number when its Call you back. (numfromdisa.txt)

    Start building Tasks then build Profiles, (and select right tasks to profile.) and finally fill the config files with your Disa numbers.



    Details

     Task 1 - CallWithDisa




                                                


    Task 2 - TakeCall



    activate 





    Profile 1 - Catchoutcall




    Profile 2 - CatchInIfDisa






    And finally task3

    Task 3 - To activate/deactivate Profile 1 - ActivateDidi

    tasker task
    convert -delay 50




    Config files:

    Make a directory on your Sdcard called "Disasterisk" with any file manager. \Sdcard\Disasterisk
    1. Make a file named to "disatriggernum.txt" and filled it with the number of your Asterisk Disa trigger number. ()
    2. Make a file, rename it to "numfromdisa.txt" and filled it with the number coming from Asterisk server when its call you back.

    Final steps:

    Put ActivateDidi Tasker task - Widget to your home screen.


    (Long Press on Homescreen -on an empty- space and choose "Application and Widget" and "Task Shortcut") it will give the list of Tasker tasks, and choose ActivateDidi task. )
    This will be a toggle button which enable or disable the Dialer behave normal or "DisAsterisk mode"