Skip to content

Sync your Google Contacts to a Asterisk phonebook for caller id identification

License

Notifications You must be signed in to change notification settings

bwint/GoogleContactsAsteriskSync

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

2 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

GoogleContactsAsteriskSync

Syncing your Google Contacts to a Asterisk phonebook for caller ID identification using python3.

Based on the idea I found here I created a script to sync Google Contacts with an Asterisk phonebook for caller ID identification.

Because the original script is a few years old, it doesn’t cover the OAuth 2.0 authentication mechanism to access the Google API. In my case I'm running a small Asterisk PBX a RaspberryPi. So I decided to use OAuth 2.0 for TV and Limited Input Device Applications.


How to use it

All Screenshots are in German, but I’m sure you’ll get the point.

  1. Activate the Contacts API in the Google API console asdf

  2. Create a project enter image description here

  3. Create a confirmation screen and an OAuth-Client-ID enter image description here

    enter image description here

    enter image description here

  4. Edit the GoogleContactsAsteriskSync.py file to suit your needs

    # Formatting the numbers
    county_code = "43"
    contact_array = format_numbers(contact_array, county_code)

    Change the country_code to yours.

    # If the second argument is set the script will send the Asterrisk commands to the print console instead of the system console
    asterisk_input(contact_array, True)

    Change it to False to execute the Asterisk commands.

    contacts_array[i][1] = contact[1].replace(" ", "")
        contacts_array[i][1] = contact[1].replace("/", "")
        contacts_array[i][1] = contact[1].replace("+" + country_code, "0")
        contacts_array[i][1] = contact[1].replace("00" + country_code, "0")
        contacts_array[i][1] = contact[1].replace("+", "00")
        if contacts_array[i][0] == None:
            contacts_array[i][0] = "No Name"

    You can change the way the number is formatted in the format_numbers function.

  5. Execute the script on your Asterisk machine

About

Sync your Google Contacts to a Asterisk phonebook for caller id identification

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages