# Originate call using api

**URL:** <https://wazo-platform.discourse.group/t/originate-call-using-api/84>\
**Category:** Development: API/Events\
**Created:** [December 10, 2019, 1:26pm UTC](https://wazo-platform.discourse.group/t/originate-call-using-api/84 "2019-12-10T13:26:22Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![benasse](https://avatars.discourse-cdn.com/v4/letter/b/e68b1a/32.png) [@benasse](https://wazo-platform.discourse.group/u/benasse)\
**Post date:** [December 10, 2019, 1:26pm UTC](https://wazo-platform.discourse.group/t/originate-call-using-api/84/1 "2019-12-10T13:26:22Z")

</div>

hello,

I’m wondering curently what is the best way to originate a call using wazo-platform api ?

Regards,

---

<div class="post-metadata">

**Author:** ![pcm](https://avatars.discourse-cdn.com/v4/letter/p/b9bd4f/32.png) [@pcm](https://wazo-platform.discourse.group/u/pcm)\
**Post date:** [December 17, 2019, 1:10pm UTC](https://wazo-platform.discourse.group/t/originate-call-using-api/84/2 "2019-12-17T13:10:39Z")

</div>

Hi,  
it really depends on the context. For example, if the call is originated from a authenticated user you can use the following call.

`curl -X POST --header 'Content-Type: application/json' --header 'Accept: application/json' --header 'X-Auth-Token: <token>' -d '{"extension": "<extension>"}' 'https://<host>/api/calld/1.0/users/me/calls'`

If you’re originating from an application you can use the following call

`curl -X POST --header 'Content-Type: application/json' --header 'Accept: application/json' --header 'X-Auth-Token: <token>' -d '{"destination": {"context": "<context>", "extension": "<exten>"}, "source": {"user": "<user_uuid>"}}' 'https://host/api/calld/1.0/calls'`

---

<div class="post-metadata">

**Author:** ![benasse](https://avatars.discourse-cdn.com/v4/letter/b/e68b1a/32.png) [@benasse](https://wazo-platform.discourse.group/u/benasse)\
**Post date:** [December 17, 2019, 1:45pm UTC](https://wazo-platform.discourse.group/t/originate-call-using-api/84/3 "2019-12-17T13:45:13Z")

</div>

Hello,

Thank you for taking the time to answer me, it is noted.

Not knowing how to do it, I quickly produced a flask application, which launches a shell command: [https://github.com/benasse/flask-originate/](https://github.com/benasse/flask-originate/)

Case 2 looks like what I would like to do, however, according to the doc, I am forced to enter a uuid user as a caller, which does not suit me too much.

---

<div class="post-metadata">

**Author:** ![pcm](https://avatars.discourse-cdn.com/v4/letter/p/b9bd4f/32.png) [@pcm](https://wazo-platform.discourse.group/u/pcm)\
**Post date:** [December 17, 2019, 2:38pm UTC](https://wazo-platform.discourse.group/t/originate-call-using-api/84/4 "2019-12-17T14:38:27Z")

</div>

Allow me to recap what I understand.

You would like an API to launch a call to and from an arbitrary context/exten

ex:  
`curl -X POST --header 'Content-Type: application/json' --header 'Accept: application/json' --header 'X-Auth-Token: <token>' -d '{"destination": {"context": "<context>", "extension": "<exten>"}, "source": {"context": "<context>", "extensions": "<exten>"}}' 'https://host/api/calld/1.0/calls'`

You can also use the /applications in calld which would also allow you to do that at a lower lever

1. create to calls (those are Asterisk channels)

`curl -X POST --header 'Content-Type: application/json' --header 'Accept: application/json' -d '{"autoanswer": false, "context": "<context>", "displayed_caller_id_name": "<cid name>", "displayed_caller_id_number": "<cid number>", "exten": "<exten>"}' 'https://<host>/api/calld/1.0/applications/%3Capplication_uuid%3E/calls'`

`curl -X POST --header 'Content-Type: application/json' --header 'Accept: application/json' -d '{"autoanswer": false, "context": "<context>", "displayed_caller_id_name": "<cid name>", "displayed_caller_id_number": "<cid number>", "exten": "<exten>"}' 'https://<host>/api/calld/1.0/applications/%3Capplication_uuid%3E/calls'`

And add the two calls to a node (which is an Asterisk bridge)

`curl -X POST --header 'Content-Type: application/json' --header 'Accept: application/json' -d '{"calls": [{"id": "<call_id_1>"}, {"id": "<call_id_2>"}]}' 'https://<host>/api/calld/1.0/applications/%3Capplication_uuid%3E/nodes'`

Before doing that you would have to create an application in wazo-confd.

---

<div class="post-metadata">

**Author:** ![benasse](https://avatars.discourse-cdn.com/v4/letter/b/e68b1a/32.png) [@benasse](https://wazo-platform.discourse.group/u/benasse)\
**Post date:** [December 18, 2019, 10:09am UTC](https://wazo-platform.discourse.group/t/originate-call-using-api/84/5 "2019-12-18T10:09:12Z")

</div>

That’s exactly what I want to do, thanks.

It is a little more complex than what I had done, I must find the time to implement it.
