feat: add call echo to line function.

This commit is contained in:
Francisco 2023-07-15 09:39:43 -05:00
parent b16aea5b1d
commit 13dc27c4e0
3 changed files with 28 additions and 1 deletions

View File

@ -35,5 +35,9 @@ class FreeswitchClient:
def uptime(self):
return self._apiCommand('uptime')
def call_echo_to_line(self, line, did_name='echo', did_number='0234'):
user = 'user/' + str(line)
return self._apiCommand(' '.join(['originate', user, '&echo()', 'nose', 'XML', did_name, did_number]))
def close(self):
self.client.close()

View File

@ -1,11 +1,33 @@
# README
Estudio: Librería para jugar con Freeswitch.
## Detalles del protocolo de Freeswitch
+ 2 saltos de linea separan el envio del comando y la respuesta recibida.
+ Al conectarse al servidor se recibe: "Content-Type: auth/request"
+ comando para autenticarse: "auth"
+ respuesta de autenticacion correcta: "Content-Type: command/reply\nReply-Text: +OK accepted"
### Documentacion defree switch api
https://developer.signalwire.com/freeswitch/FreeSWITCH-Explained/Modules/mod_commands_1966741/
#### convencion de la documentacion
+ <> indica que el parámetro es obligatorio
+ | sindica ó o ór
+ [] opcional
## Ejercicios
### 2023-07-15
```
api originate user/1002 &echo()
```
```
originate user/1002 &echo() nose XML nombre 2342343
```
## Tests
Correr los tests
```sh
python -m unittest tests/response_metadata.py

View File

@ -17,4 +17,5 @@ except:
raise
print(client.uptime())
print(client.call_echo_to_line(1002, 'prueba', '234435345345'))
#print(client.uptime())