API "telephony" : Automatisation d'appel AutomaticCall

Ma société possède un abonnement VOIP et notre standard téléphonique passe par cet abonnement.

Je cherche à automatiser un appel avec l’API « telephony » en utilisant un numéro fourni par OVH.

Sur la console web (https://api.ovh.com/console/ dans le navigateur), tout se passe bien lorsque je teste :

POST https://api.ovh.com/console/#/telephony/{billingAccount}/line/{serviceName}/automaticCall

billingAccount = mon identifiant ovhtel (ovhtel-XXXXXX-1)
serviceName = mon numéro de téléphone OVH (00339XXXXXXXX)
bridgeNumberDialplan=NULL, # Number to call if transfer in dialplan selected (type: phoneNumber)
calledNumber='00336XXXXXXXX', # Number to call (type: phoneNumber)
callingNumber= NULL, # Optional, number where the call come from (type: phoneNumber)
dialplan='ReadText', # Dialplan used for the call (type: telephony.CallsGeneratorDialplanEnum)
isAnonymous=False, # For anonymous call (type: boolean)
playbackAudioFileDialplan= NULL, # Name of the audioFile (if needed) with extention. This audio file must have been upload previously (type: string)
timeout=120, # Timeout (in seconds). Default is 20 seconds (type: long)
ttsTextDialplan='. . . . salut . . . comment vas-tu ce matin ? . . . . . . . .', # Text to read if TTS on dialplan selected (type: string)

=> J’obtiens bien un appel sur mon mobile.
L'identifiant de la connexion retourné est : 414025472

Dans mon script PYTHON:
Je me connecte à l'API OVH:

import ovh
client = ovh.Client(
endpoint = 'ovh-eu',
application_key = 'xxxxxxxx',
application_secret = 'xxxxxxxx',
consumer_key = 'xxxxxxxx',
)
client.get('/telephony/ovhtel-XXXXXX-1/line/00339XXXXXXXX')
# OK: J'obtiens une réponse correcte à cette requête
# Je suis donc bien connecté sur l'API OV

client.get('/telephony/ovhtel- XXXXXX -1/line/00339XXXXXXXX'/automaticCall/414025472')
# L'identifiant "414025472" est celui de la connexion via api.ovh.com
# OK: J'obtiens bien un retour JSON me donnant les infos relatives à ma connexion avec succès sur api.ovh.com

client.post('/telephony/ovhtel- XXXXXX -1/line/00339XXXXXXXX'/automaticCall',
bridgeNumberDialplan=None, # Number to call if transfer in dialplan selected (type: phoneNumber)
calledNumber='00336XXXXXXXX', # Number to call (type: phoneNumber)
callingNumber=None, # Optional, number where the call come from (type: phoneNumber)
dialplan='ReadText', # Dialplan used for the call (type: telephony.CallsGeneratorDialplanEnum)
isAnonymous=False, # For anonymous call (type: boolean)
playbackAudioFileDialplan=None, # Name of the audioFile (if needed) with extention. This audio file must have been upload previously (type: string)
timeout=120, # Timeout (in seconds). Default is 20 seconds (type: long)
ttsTextDialplan='. . . . salut . . . comment vas-tu ce matin ? . . . . . . . .', # Text to read if TTS on dialplan selected (type: string)
)
# Je reprends STRICTEMENT les mêmes paramètres que ceux fournis par la console du browser (copier-coller)
# ERREUR: J'obtiens l'exception: "This call has not been granted".

=> Ce retour de l'API m'incite à penser qu'il y un problème de droit, rencontré sur endpoint = 'ovh-eu' mais pas sur "https://api.ovh.com/" ??

Bonjour @73aa270c71a785cfcf89,

Avez-vous pu trouver une solution depuis la création de votre sujet ?

@JeanL64, @adion avez-vous déjà rencontré ce type de situation ?

Merci d'avance pour les retours que vous seriez à même d'apporter :slight_smile:

^FabL

Bonjour,

j'ai eu la même situation.
Je suis donc passé par la nouvelle console API OVH
qui génère un token ensuite un cURL.

J'ai modifié le cURL pour l'intégrer au PYTHON.

Ce qu'il y avait de plus c'est : "H "authorization: Bearer " avec la clé.
A mon avis c'est ce qu'il manque dans le code plus haut. En tout cas j'ai eu le même problème que j'ai résolu.