M
M
Men1steR2022-01-17 16:13:20
VoIP
Men1steR, 2022-01-17 16:13:20

How to call via python using goip gateway?

There is a goip4 gateway, there is a need to call through it through python, you don’t need to talk or receive calls, you just need to make a call to a given number. How can this be implemented?

Answer the question

In order to leave comments, you need to log in

1 answer(s)
D
Drill, 2022-01-20
@Men1steR

import requests
import re

url = 'http://login:[email protected]_IP_address/default/en_US/tools.html?type=dial'
responce = requests.get(url)

# Находим dialkey
dialkey = re.search('name=\"dialkey\" value=\"(.*?)\">', responce.text).group(1)

# Задаем параметры звонка

# Скакой линии звонить
line = 1

# Номер телефона
phone = "номер_телефона"

# Продолжительность звонка, сек
seconds = 5


params = {'line': line,
          'dialkey': dialkey,
          'action': 'dial',
          'telnum': phone,
          'duration': seconds,
          'dial': 'Dial',
         }

# Звоним
requests.post(url, data=params)

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question